Python Lecture Notes-day01 Introduction, basic grammar, Process Control

Source: Internet
Author: User

The content of this section
    1. Python Introduction
    2. History
    3. Python 2 or 3?
    4. Installation
    5. Hello World Program
    6. Variable
    7. User input
    8. Module Initial Knowledge
    9. What the hell is a. pyc?
    10. Initial knowledge of data types
    11. Data operations
    12. Expression If ... else statement
    13. An expression for loop
    14. Break and Continue
    15. An expression while loop
    16. Job Requirements
Python Introduction

In December 1989, Guido van Rossum (Guido van Rossum)--Uncle Tortoise founded the python.

python history

In December 1989, Guido van Rossum (Guido van Rossum)--Uncle Tortoise founded the python.

1991, the first Python compiler was born. It is implemented in C language and can call the C language library file. From birth, Python already has: classes, functions, exception handling, core data types including tables and dictionaries, and module-based expansion systems.


Python 1.0-january 1994 adds lambda, map, filter and reduce.
1999 Python web framework ancestor--zope 1 released
Python 2.0-2000/10/16, added a memory recovery mechanism that forms the basis of the Python language framework Now
Python 2.4–2004/11/30, the most popular web framework in the same year, Django is born
Python 2.5-2006/09/19
Python 2.6-2008/10/1
Python 2.7-2010/07/03 #目前业内主流使用的工业版本依然是2.7

Python 3.0-2008/12/03
Python 3.1-2009/06/27
Python 3.2-2011/02/20
Python 3.3-2012/09/29
Python 3.4-2014/03/16
Python 3.5-2015/09/13

In November 2014, Python2.7 will be released in 2020, and will not release the 2.8 release, it is recommended that users migrate as far as possible to 3.4 +

Python2 or Python3?

py2.7 is the last version of the 2.x series and has stopped developing without adding new features. 2020 termination of support.

Updates to all the latest standard libraries will only be available in the 3.x version.

Uncle Turtle decided to clean up the python2.x and was no longer compatible with the old version. One of the biggest changes is to use Unicode as the default encoding. pyhton2.x (the default encoding is Assic) directly written in Chinese will be an error, Python3 (the default encoding is Unicode) can be directly written in Chinese.

From open source projects, the proportion of support py3 has been greatly improved, and well-known projects generally support py2.7 and py3+.

PY3 is more standardized than py2, removing unnecessary keywords

Python3.x continues to improve

So we still recommend that you use python3.x.

command-line mode and Python interaction mode

In the Windows Start menu, select "Command Prompt" (or start (win+r) ~~cmd) and go to the command line mode with a prompt similar toC:\>

In command-line mode python , you can see a bunch of text output similar to the following, and then enter the Python interactive mode, with the prompt>>>

Enter in Python interactive mode, exit() exit the Python interaction mode, and return to the command line mode:

You can also directly enter the python interactive mode by selecting the menu item directly from the Start menu, Python (command line) but exit() the input window will be closed directly and will not return to the command line mode.

Note the distinction between command-line mode and Python interaction mode.

The code for the Python interaction pattern is to enter a line, execute a line, and print out the results of each line of Python code automatically;

Running .py a file directly in command-line mode is a one-time execution of all code within that file. Execution of a .py file can only be performed in command-line mode.

It can be seen that the Python interaction mode is mainly for debugging Python code, but also easy for beginners to learn, it is not a formal environment to run Python code!

First program--hello World1. Create a new text file with the program to print Hello World
2. Open the command line that comes with your computer: Start--cmd
3. Switch path to the path where your files are located CD C: \ (or directly on D:)
Cd=change directory (switch path) does not switch.
4. The path of executing the file execution program and the name of the executing program (and suffix) + space + (the path where the executable file is located and) the filename and suffix

As shown above: 1 is the execution of the program (its path can not be specified, because we installed the program when the environment variable has been configured, indicating the path of the program)

2 is a space that has a space between the executing program and the file to be executed

3 is the execution of the file and its path, when the command-line program does not switch to the path of the file to be executed, it is necessary to explicitly indicate its path, when the path of a folder name contains spaces, enclose in double quotation marks.

Attention:



Python Lecture Notes-day01 Introduction, basic grammar, Process Control

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.