python recognizes identifiers

#pythonidentifier _

When Python is programming, its name is called an identifier, and variables and constants are a kind of identifier.

 

#nomenclature

The naming of identifiers in python is regular. The identifiers that can be used according to the correct naming rules are called valid identifiers, otherwise the identifiers that cannot be used are called invalid identifiers. There are several rules for valid identifier names:

The first character of the identifier must only be a letter or an underscore, and the first character cannot contain numbers or other characters; except for the first character, other parts of the identifier can be letters, underscores or numbers; the identifier is case-sensitive, such as name and Name are different identifiers.

 

example:

#correct naming rules

1

oop_2=123456

Print oop_2

 

2

_oop2=123456

Print _oop2

 

# wrong naming convention

2oop=123456

print 2oop

 

#Commonly used keywords in python

A keyword in Python refers to an identifier with a specific meaning that comes with the system. Commonly used python keywords are: and , elif , global , or , else , pass , break , continue , import , class , return , for , while

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325324735&siteId=291194637