Object oriented and process oriented, the entry--main method of the program in the class Class,python in Python,

Source: Internet
Author: User

1, the program entrance, let main show out:

Print (__name__) #__name___是模块中的隐藏字段, function name of the current module run

if __name__ = = __main__

__MAIN__ ()

#定义程序入口: In Python, the main function is hidden by default, and the main function, under the currently running module, defines the program entry to make the main function explicit #现出来

Def __main__ ():

。。。。。。。

2. Object-oriented and process-oriented:

Object-oriented: Use objects to accomplish tasks, do not need to care about the process;

3. What is a class: A type that defines class to represent a type of information, such as int, function is a class, and we can define our own classes as needed,

Class Alei ():

A = 1;

b = 3;

DEF ABC ():

....

This allows us to generate a alei that can be viewed with type ()

Object oriented and process oriented, the entry--main method of the program in the class Class,python in Python,

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.