Initial knowledge and variables of Python basic-----(II.)

Source: Internet
Author: User

1. The suffix name of a python file can theoretically be arbitrary, but note: when the Python file that is written is to be imported as a module, the prefix must be. py.

So the python file suffix is best known as. py.

2. Different system execution of the py file difference:

A, under Windows, the execution of the py file can be as follows:

CDM--->d:\python3\python 1.py (environment variable not configured)

CMD--->python 1.py (configured environment variable to add Python.exe path to environment variable)

b, under Linux, the implementation of the Py file can be as follows

./2.py such words must be added inside the file:

1 # !/usr/bin/enc python   2 # -*-coding:utf-8-*-

As the above code, the first line is used to declare the Python interpreter used, the second line indicates the code type (if the code contains Chinese, then the line of code in the Python3 is not necessary in the python2, in the case of the code in English is not required this code).

Initial knowledge and variables of Python basic-----(II.)

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.