Python three kinds of implementation

1, Python source code is a specially formatted text file, you can use any text editor to do software development in python, python .py file name extension
 
2, the implementation of the program in three ways python
  • Interpreter: input command line: If the input python D: /Code/Python/Hello.py
  python interpreter: Cpython, pypy etc.
 
  • Interactive: The so-called interactive: run directly in the terminal command interpreter, without the need to enter the name of the file to perform
The first way: at the command line ipython or ipython3 into the interactive shell environment
If not, then you need to install python mirror and ipython
Commonly used Python mirror address: https://blog.csdn.net/yamadeee/article/details/80178996
Configuration: PIP3 install IPython -i https://pypi.tuna.tsinghua.edu.cn/simple
Release ctrl + D or exit ipython
Ipython advantages: Support for auto-completion and implementation of linux command
The second way: in the command line window, type python (official shell)
Here python program code can be entered directly exit by exit () or ctrl + D
 
  • Integrated development environment: PyCharm similar IDEA
 
3, Python common grammatical errors
  • NameError: name 'rint' is not defined (Name Error: print name is not defined)
  • SyntaxError: invalid syntax (Syntax Error: Invalid syntax)
  • IndentationError: unexpected indent (indentation errors: undesirable indentation)
Note: Python can not add a space before each line of code, and is not only responsible for the implementation of a line of action
  • python2.X does not support Chinese encoding, it will report a syntax error
 
 
 
 

Guess you like

Origin www.cnblogs.com/wysk/p/11277607.html