Linux comes with
Go to input python
Exit exit () or Ctrl+d
Output display
print "Field"
Script definition
#!/usr/bin/env python #让env自动去寻找python解析器
Python Set auto-complete function (tab)
Python mode
>> Import ReadLine
>> Import Rlcompleter
>> readline.parse_and_bind (' Tab:complete ')
>> P
Pass POW (print print (
System Configuration
vim/usr/local/bin/tab.py
#!/usr/bin/env python
Import Readline,rlcompleter
Readline.parse_and_bind ("Tab:complete")
Vim ~/.bash_profile
Path= $PATH: $HOME/bin
pythonstartup=/usr/local/bin/tab.py
Export PATH Pythonstartup
SOURCE ~/.bash_profile
chmod a+x/usr/local/bin/tab.py
Echo $PYTHONSTARTUP
Install PIP
PIP enables automatic installation of software modules
Pip Install
python2.7 the tool from the previous version
Statement block indentation
The Python code block expresses the code logic with indentation alignment instead of curly braces
Indent expression A statement belongs to that block of code
Indent style
1 or 2: It may not be enough to make sure that the code statement belongs to that block
8 to 10: Maybe too many, if the code is embedded too many layers, it will make the code difficult to read
4 spaces: Very popular, Van Rossam supported style
Child statement indentation requires the same
indentationerror:unexpexted indent (Indent exception) #冒号左边异常名称, colon right exception reason
Python Environment Preparation 01