Programming of Python Learning

Source: Internet
Author: User

1. Build Python environment

Interactive mode: Input Python enters interactive mode, exit () exits interactive mode

Text mode: Create a new *.py file, edit the *.py file, run Python *.py

2. python file type

(1) Source code: Python Source code file with "py" as the extension, interpreted by the Python program, do not need to compile.

For 1.py file standard notation:

#!/usr/bin/python

print ' Hello World '

Run: Mode one: Python 1.py

Way two:./1.py #前提是1. py file has executable permissions

(2) Byte code: The python source file is compiled with the file extension "PYc" and is binary code.

The contents of 2.py are: import py_compile

Py_compile.compile ("1.py")

Running a 2.py file generates a 1.PYC file and 1.pyc is a compiled binary file

3. Optimized code: Optimized source file with ". pyo" extension, binary code

Optimization mode: Python-o-M Py_compile 1.py

Programming of Python Learning

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.