Home >Backend Development >Python Tutorial >What is the naming convention for legal identifiers in python

What is the naming convention for legal identifiers in python

王林
王林Original
2020-05-27 11:14:5111142browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:python int function usageNext article:python int function usage