First, what is Python
Python is an object-oriented, interpretive type of computer language.
It is characterized by simple grammar, elegant, easy to learn.
So what is automation, simply writing code to help you test. The development language of the system being tested, and the language used to automate it, doesn't matter. Whether the system being tested is Java or C, it can be automated with Python.
Second, compiled language and interpretive language
Computers are only aware of binary 0 and 1, so written programs require compilers to be compiled into computer languages to execute.
1. Compiled language
Concept: After writing the code, compile the code into a binary file and run the compiled binaries when running.
Features: Run fast, compile once, run everywhere. However, the compilation process is relatively slow.
Examples: c, C + +, C # are compiled languages.
2. Interpreted language
Concept: When the program runs, through an interpreter, run a line of code to compile a line, when to run the code, when to compile the code.
Characteristics: Running speed is relatively slow.
Examples: Php, Python, Ruby, Java, go, JavaScript, Perl, and so on are all interpreted languages.
Exception: Although Java needs to be compiled into a class file and then executed, but the class file is not a binary file and requires the JVM to read the class file, Java is still an interpreted language.
Iii. scripting language 1, what is a scripting language
A single language, called a scripting language.
Shell, Bat, JavaScript (previous paragraph), HTML (page), VB are all scripting languages.
2. Python is not a scripting language
Python is no longer a single scripting language, it can be used for background service development, data Mining (crawler), data analysis, artificial intelligence, automated operation and maintenance, automated testing and so on.
Iv. version of Python
There are now two versions of python2.x and python3.x, both of which are not very compatible. The biggest advantage of Python3 is that its default character set is Unicode, so it's much more time-saving when working with Chinese.
1, python2.x
The most commonly used Python2.7, the official website is not maintained after 2020 years
Python2 The default character set is ASCII encoding, write Chinese will error
2, python3.x
The default character set is Unicode
3. Character Set
ASCII code:
With 127 numbers, representing all the English uppercase and lowercase letters and symbols
GB2312:
Take 127 after the number, as long as the number encountered this interval, you know it is Chinese, go to another code table inside, this contains Chinese, there are Japanese, Korean and so on
Unicode:
Also called the universal Code, which country of the text is applicable, but it whether you are an English letter, or a Chinese character are accounted for 2 bytes of size
UTF-8:
It also belongs to Unicode, and unlike Unicode, it compresses Unicode, such as the English alphabet or a single byte.
V. Installation of Python
The Python command needs to be added to the environment variables for the Python installation directory
Windows also adds the scripts directory under the Python installation directory to the environment variables, because some python executable commands, such as PIP, are installed in this directory. The environment variable was written by default when Python3 was installed.
Linux because the default with Python, if you want to upgrade the version of the system, you have to rename the Python or uninstall, and then install the Python version you want, Under CentOS because Yum relies on its own python2.6, all cannot be uninstalled, modify the Python environment variable location within the Yum script to
Python Learning Note _python Introduction