Python's identifier naming rules

Identifiers, variable names, function names, and class names are collectively named
Naming conventions
1. Can only contain letters, numbers, underscores, and cannot start with numbers
2. Cannot be the same as system keywords and module names
>>> import keyword
>>> print(keyword.kwlist)
['False', 'None', 'True', '__peg_parser__', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
3. Strictly case-sensitive
4. Try to use meaningful English words 5. Use underscores
to connect multiple words Variable declaration: take a name and give a value

Guess you like

Origin blog.csdn.net/lu962820662/article/details/123528875