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

王林
Release: 2020-05-27 11:14:51
Original
11169 people have browsed it

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
Copy after login

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template