1. Don't use Python's built-in functions as your own identifiers.
2.② Identifiers cannot be python keywords, but they can contain keywords. ③ Identifiers cannot contain spaces.
3. Identifiers can be function names, class names, variable names, module names and project names. Identifiers cannot use keywords. You can view all the keywords in python through keyword.kwlist.
4. Keywords are identifiers with special functions in Python, which has been used, so developers are not allowed to define identifiers with the same name as keywords.
5.④ Identifiers cannot be keywords and reserved words of Python language; ⑤ Identifiers are case-sensitive. Num 1 and Num2 are two different identifiers. 6. The naming of identifiers should be meaningful, and the meaning should be known by name. Python keyword Python predefines some special identifiers for the language itself.
6. Identifiers consist of characters (a-z and A-Z), underscores and numbers, but the first character cannot be a number. Identifiers cannot be the same as reserved words in Python.
Python basic syntax and variables
The address of a storage unit named by an identifier is called a variable, which is used to store data. The value of a variable can be obtained by an identifier, and the variable can also be assigned a value.
Python basic syntax: such as the declaration and call of variables, basic output statements, code block syntax, comments, etc. : data type: usually numbers, strings, Boolean values, arrays, linked lists, maps, collections, etc. Operator: arithmetic operator, assignment operator, comparison operator, logic operator, bit operator, etc.
There are two ways to index strings in Python, starting from 0 from left to right and starting from-1 from right to left. Strings in Python cannot be changed. Python has no single character type, and a character is a string with the length of 1
Those are built-in variable name help that can't be used in python.
1 and Pythonx have poor support for Chinese. If you want to use Chinese characters or variables in a Python program, you need to add "# coding: UTF-8" to the first line of the Python source program. Of course, don't forget to save the source file as UTF-8 character set.
2. Reserved keywords cannot be used as variable names. Python programming fixed identifiers are composed of letters, numbers and underscores. The first character must be a letter or underscore, not a number. In identifiers, the case of letters is determined by.
3. Legal identifiers in 3.Python can be named by uppercase letters, lowercase letters, numbers, underscores, Chinese characters and their combinations, but the first letter cannot be a number.
4. The variable name is not limited in length, but its characters must be letters, numbers or underscores (_), and spaces, hyphens, punctuation marks, quotation marks or other characters cannot be used. The first character of a variable name cannot be a number, it must be a letter or an underscore. Python is case sensitive.
5. The symbol R[2] cannot be used as the variable name of python. Python needs to use identifiers to name variables. When using identifiers, you should pay attention to the following rules. Identifiers can consist of letters, numbers, and underscores (_), which cannot start with numbers. Identifiers cannot be Python keywords, but they can contain keywords.
6. Variable names cannot contain spaces, but underscores can be used to separate words. For example, the variable name greeting_message is feasible, but the variable name greetingmessage will cause an error. Do not use Python keywords and function names as variable names, that is, do not use Python to reserve words for special purposes, such as printing.