python comments, script parameters, bytecode
--Tao Xin
python installation
1. Download the installation package
https://www.python.org/downloads/
2. Installation
Default installation path: C:\python27
3. Configure Environment variables
"Right-click Computer"-"Properties"-"Advanced system Settings"-"Advanced"-"Environment variable"-"in the second content box to find the variable named path of a row, double-click"-"Python installation directory appended to the variable value, with;
such as: the original value; C:\python27, remember that there's a semicolon in front
NotesSingle-line Comment #
eg
# print "123"
Multiline comment "" "" ""
(three quotes start, end)
eg
“””
Import Sys
Print SYS.ARGV
print ' Hello, world '
“””
Style= "Background-color: #ff0000;" > Script Parameters
Python has a large number of modules, which makes developing Python programs very concise. The class library includes three:
- Python-supplied modules
- Industry-Open Source modules
- Modules developed by programmers themselves
eg
New hello.py
#!/usr/bin/env python
#-*-Coding:utf-8-*-
Import Sys
Print SYS.ARGV
print ' Hello, world '
#捕获参数
Input: Python hello.py localhost:8001
Output: [' hello.py ', ' localhost:8001 ']
Hello, world
byte code
eg
New hello.py File
#!/usr/bin/env python
#-*-Coding:utf-8-*-
print ' Hello, world '
#字节码
Import m
print "Hello"
New m.py File
#!/usr/bin/env python
#-*-Coding:utf-8-*-
print "Hello Daoxin"
Input: Python hello.py localhost:8001
Output: Hello, world
Hello Daoxin
Hello
Execution process: hello.py will import the module in m.py
Note: If M.PYC performs the same function as m.py, execute the M.PYC directly; If the function is not the same, the execution m.py after the formation of M.PYC re-execution
Python comments, script parameters, bytecode