Home  >  Article  >  Backend Development  >  Definition of python variables

Definition of python variables

高洛峰
高洛峰Original
2017-03-10 14:09:541934browse

Function: Store data, be called, identify data (variable data is stored in memory, data is temporary)


name = "abc"

#name: variable name abc: value of variable name

print (name)

#Call the name variable and print the variable


## Important note:


Characters in Python with single or double quotes are considered strings by Python.


Declaration rules:


1. Must have identification meaning


2. Variable names can only be a combination of letters, numbers or underscores


3. The first letter cannot be a number


4.Python built-in variables cannot be used as variable names (for example: and, class)


Key examples:


name = "aaa"


name2 = name


print (name, name2)


name = "bbb"


print (name name2)


Output:

aaa,aaa


                  bbb,aaa


                                                                                                                                                      

The above is the detailed content of Definition of python variables. 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