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