Python Variable naming conventions

Source: Internet
Author: User
Tags reserved

Naming rules for variables
1, to have a descriptive
2, variable name can only _, number, letter composition, can not be a space or special characters ([email protected]#$%^&*~)
3. Cannot use Chinese as variable name
4. Cannot start with a number
5. Variable names are case-sensitive
6. Reserved characters cannot be used to name
The following keywords (reserved characters) cannot be declared as variable names
[' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' def ',
' del ', ' elif ', ' Else ', ' except ', ' exec ', ' finally ', ' for ', ' from ',
' Global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ',
' Print ', ' raise ', ' return ', ' try ', ' while ', ' with ', ' yield '

Cases:

Student_number=30 #Python官方建议命名规则
Studnetnumber=30 #驼峰体

Constant
There are no constants in Python, and all the quantities are variable,
In order to differentiate constants and variables, constants are represented as constants with all uppercase variable names.

Python Variable naming conventions

Related Article

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.