Home >Backend Development >Python Tutorial >What is the naming convention for legal identifiers in python
Naming rules for legal identifiers:
1. Identifiers are composed of characters (A~Z and a~z), underscores and numbers, but the first characters cannot be numbers;
2. The identifier cannot be the same as a reserved word in Python;
3. Python identifiers cannot contain special characters such as spaces, @, %, and $ .
Examples of legal identifiers are as follows:
UserID name mode12 user_age
Recommended tutorial: python tutorial
The above is the detailed content of What is the naming convention for legal identifiers in python. For more information, please follow other related articles on the PHP Chinese website!