Get the App
SLTechnology News&Howtos  ›  Development  › 

What should be paid attention to when using python identifiers

Shulou Source: shulou.com Published: 2022-06-03 17:38:03 09月28日 Update

Editor to share with you the use of python identifiers need to pay attention to what, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

1. The identifier consists of characters, underscores, and numbers, but the first character cannot be a number.

2. Reserved characters cannot be the same as identifiers.

3. Cannot contain special characters such as spaces, @,%, and $.

4. Letters are strictly case sensitive.

Although identifiers can be underlined, identifiers that begin with underscores often have special meanings, so it is not recommended to use identifiers that begin with underscores unless you really want to do so.

Example

Example: the following identification conforms to the law: abcdabc_dAbc_3dIF / / python is case-sensitive, so if is a reserved word, but IF is not The following identifiers can be used illegally: 3abc / / numbers cannot start with if / / identifiers cannot be the same as reserved words @ abc / / identifiers cannot have spaces, @,%, and $and other special characters are all the contents of this article "what do you need to pay attention to in the use of python identifiers"? thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Identity identifier character underscore special beginning number article same content size legal not so much meaning most letters examples suggestions more knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia OPPO Reno Linux Shulou Tech Info