Python Quick Start
Python mainstream version 2.6 \ 71. CentOS view Python version
[Root @ host ~] # Python-V # view python version number Python2.6.6
2. Enter the Python Command Line Mode
>>> Print "hello world" # print hello worldhelloworld
3. How to compile a Python script
[Root @ host python] # cat test. py #! /Usr/bin/env python # can also be used #! /Usr/bin/pythonprint "hello world" # print hello world
4. How to run a Python script
[Root @ host python] # python test. py # first execution method helloworld [root @ host python] # chmod 755 test. py # method 2 [root @ host python] #. /test. pyhelloworld
5. How to import modules
>>> Import test [root @ host python] # lstest. py test. pyc # generates a file named test. pyc, because python has installed a virtual machine compiler, which reads the code I wrote, converts it to the C language, and then runs it on the system. When I import the test. py module, it will be converted to the C language.