python program implementation and common errors

Mistake

  • Programs written not perform properly or execution result is not what we expect, commonly known as the BUG, ​​is a programmer in the development of very common, common mistakes beginners reasons include:

    1. mistake
    2. Already learned knowledge to understand there are still insufficient
    3. There is need for content and promotion of language learning
  • When learning a language, not only to learn the syntax of the language, but also learn how to recognize errors and methods to resolve errors

    Every programmer is growing constantly correct errors in

Common mistakes:

  • 1> wrong hands
  • 2> the number of print on one line
    through each line of code responsible for an action
  • 3> indentation errors
    Python is a very strict format programming language
  • 4> python 2.x default does not support Chinese
    python2.x interpreter Python
    python3.x interpreter python3 (support Chinese)

    Python 2.x and 3.x version introduced

  • Python2.x is the last version, Python3.x now and in the future mainstream version
    Python3.x not consider backward compatibility when designing
    excessive Python2.6 official version, the basic use of Python2.x syntax and libraries, taking into account the migration to Python3.0, allowing the use of part Python3.0 syntax and function
    in 2010 launched Python2.7 is determined to be the last version Python2.x
    if developed, can not be used immediately Python3.x (there very few third-party libraries do not support 3.0 syntax), it is recommended to develop with Python3.0 version, and then performed using python2.7, and do some processing compatibility

Three ways to execute Python programs

1, the interpreter: python / python3 interactive program run python
advantages

  • Suitable for learning / verification codes or locally python syntax
    disadvantages
  • Code can not be saved
  • Not suitable for running much of the program
    to exit the interpreter
  • exit()
  • Shortcut key ctrl-D

2, ipython interpreter

  • IPython is a python's interactive shell , than the default python shell much more useful
    support auto-completion
    auto-indent
    support the bash shell command
    built a lot of features and useful functions
  • IPython is based on the BSD open source
    version: ipython / ipython3

3, python the IDE - pycharm

Guess you like

Origin blog.51cto.com/tobeys/2438450