003dayPython Learning initial module and byte code

Source: Internet
Author: User

First, note:
1. Single-line Comment
# content being commented on
2, multi-line Comment
"""
Content being commented on
"""

Second, the module
When we are programming, we tend to be a master. py file, multiple feature files that are imported into the main file when a feature is used
These feature files end in. py, which we can call modules

Modules are divided into system modules and custom modules
System module is in the system itself, like SYS, time and other modules
and the custom module is what we wrote. py file

Import module with import+ module name, example:
Import Sys
At runtime, the import SYS line will be replaced with the corresponding function

Three, byte code
When we execute the Import function file in the main file, we find that there is a file with the same name as the. PYc in the disk, and this. pyc file is a byte-code
We know that Python is running: Python---machine code--Computer
If there is a direct byte code, it will improve the efficiency of python, because the process of converting code into bytecode is eliminated.
The system will first look for the. pyc file, in other words, if there is a. py file, but there are. pyc files that can be run as programs

003dayPython Learning initial module and byte code

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.