Python Environment Preparation 01

Source: Internet
Author: User
Tags print print

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.