python-variables

variable:

The function records the state, and the writer processes the changes of the state

string

number

list

Ganso

Dictionaries are used to store different states

Mutable and immutable:

Immutable: You modify the value of the variable, but its id changes, the variable is immutable

string

number

Ganso

>>> name = "aaa"

>>> print(name)

aaa

>>> name

'aaa'

>>> name

'aaa'

>>> id(name)

37541008

>>> name = "yuedapeng"

>>> name

'yuedapeng'

>>> id(name)

37537264 #Address of variable

Mutable: You modify the value of the variable, but his id does not change

list

dictionary

1. Just ask directly: Numbers

2. Access sequence:

string

list

Ganso

3. Mapping: Dictionary

4. The number of stored elements:

5. Container type: list, tuple, dictionary

6. Atoms: numbers, strings

 

 





Guess you like

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