Python programming (1)

zhaozj2021-02-08  195

First chapter introduction

The scripting language is a language similar to DOS batch, UNIX shell program. The scripting language does not need each compilation, and can easily access the running programs, even dynamically modifying the running program, which is suitable for rapid development and complete some simple tasks. New features that often need to be increased when using scripting languages, but sometimes because the scripting language is already very slow, very, very complicated, and cannot be implemented; or the required function involves only system calls available with C language. Or other functions - the problem that is usually to solve is not important to the extent that must be rewritten in C language; or solve problems requires data types such as variable length strings (such as the order list of file names), such data types It is very easy in the scripting language and the C language requires a lot of work to be implemented; or the programmer is not familiar with C language: these conditions can still use scripting languages.

In this case, Python may just fit your needs. Python is simple, but it is a real programming, and more structure than the shell and support for large programs. On the other hand, it provides more error checks than C, which is a very advanced language, built-in various advanced data structures, such as flexible arrays and dictionaries, these data structures should be used to implement, you may take you. A few days. Since Python has a more general data structure, it is wide than the scope of AWK or even Perl, and many things are as easy as in Python.

Python allows you to break up the program into modules, and modules can be reused in other Python programs. It comes with a large number of standard modules that can be used as the basis of your own program - or as an example of learning Python programming. The system also provides things about file input, system call, sockets, and even providing a universal interface for window system (STDWIN).

Python is an explanatory language because it is not necessary to compile and connect, so you can save a lot of program development time. The interpreter can be used interact, which can be easily tested in various characteristics of the language, and write only one program, or the test function is developed upward upward. It is also a convenient calculator.

Python allows you to write a very rigorous and readable program. Programs written with Python are usually shorter than the corresponding C procedures, because the following reasons:

Advanced data structures allow you to express complex operations with a statement; composite statement is indentation instead of brackets that indicate start and end; no variable declaration or parameter declaration is required. Python is expandable: If you use C language programming, you can easily add new built-in functions or modules for interpreter, which can perform key operations at the fastest speed, or put the Python program and only binary code. (If the graphics library provided by different vendors) is connected. When you become really in the line, you can connect the Python interpreter with the application written by C, extend it as the extension or command language of the application.

Python's name is obtained by the "Monty Python's Flying Circus" program of BBC, and there is no relationship with the boa.

转载请注明原文地址:https://www.9cbs.com/read-2260.html

New Post(0)