01-Python Introduction & Installation

A, Python Introduction

  "Life is short, I used Python." A lot of people should be the source of the original Python impression. And before I am familiar with different C, Python grammar is relatively simple and convenient, has a good code base (the legendary "built-in battery" --batteries included), also has a large number of third-party libraries. Thus, Python developers can call a lot of ready-made function, do not have to create the wheel, thus greatly improving the speed of development.

  In addition, similar to Java, Python can also cross-platform operation.

  As the saying goes, "No gold", Python is not perfect.

  As an interpreted language, Python code when executed, there must be a process of translation into machine code line by line. And compared to a compiled language, which is inherent gap. However, although the objective existence of this gap, but it may not really have a real impact on us. With the enhancement of CPU performance, the impact brought by code running speed significantly reduced, contradictory gradually turn restrictions other resources (such as network speed).

  Further, Python code is not encrypted. If you want to write software to other people, then this is a very serious flaw. But if we are selling a service, it will not be affected.

 

Second, install Python

  Python programming carried out before, we must first install Python. From this we can get Python interpreter, the command-line interactive environment and a simple integrated development environment.

  Here only recording windows of the installation process, you need to install Python's shoes on a Mac or Linux can be the venue and Baidu search method.

  The installation program is first acquired windows version: 64 , 32 . Then run the downloaded installation package, pay attention to check the "Add Python 3.X to PATH", click "Install Now".

  Verify that the installation was successful: enter cmd, enter Python, such as the output of the Python version, then the installation was successful. Python >>> prompt means that we are in an interactive environment, enter exit () and press Enter, it will exit the Python interactive environment.

 

Three, Python interpreter

  Mentioned above, Python is an interpreted language. To run the code, we need to execute Python interpreter .py file. Python interpreter is more than one, the following are the more common interpreter.

  CPython

  The official interpreter, the most widely used. C language development, said CPython.

  IPython

  Based on CPython, only the interpreter has been enhanced in the interactive mode.

  Note: CPython prompt is >>> , IPython prompt is In [ID]:

  PyPy

  The use of JIT technology, Python dynamic compilation (not explain oh). Fast execution speed. Since PyPy and CPython differences, the same in both runs Python code interpreter, the result may be different.

  Jython

  Run in the Java platform, Python code can be compiled into Java byte code execution.

  IronPython

  .Net platform runs may be .Net Python code into bytecode execution.

Guess you like

Origin www.cnblogs.com/murongmochen/p/11650115.html