Python Basic Learning Identifiers

Source: Internet
Author: User

1. Valid python identifiers

Python identifier string rules are similar to most other high-level languages written in C:

    • The first character must be a letter or an underscore (_)
    • The remaining characters can be letters and numbers or a glide line
    • Case sensitive

Identifiers cannot start with numbers, except for underscores, which are not allowed for other symbols.

2. Key Words
1>>>Importkeyword2>>>Print(keyword.kwlist)3['False','None','True',' and',' as','assert',

' Break','class','Continue','def','del','elif',

'Else','except','finally',' for',' from','Global',

'if','Import','inch',' is','Lambda','nonlocal',' not',

'or','Pass','Raise','return','Try',' while',' with',

'yield']
3. Special underline identifier

Python uses underscores as variable prefixes and suffixes to make special variables.

    • Generally speaking, _xxx is considered private and cannot be used outside of a module or class.
    • __xxx__ System Definition Name
    • The name of the private variable in the __ class.

  Avoid using underscores as the start of variable names!

Python Basic Learning Identifiers

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.