Collection
He's working on the dictionary. The collection of tuples is a counter
No matter the depth, the shallow, the assignment copy memory address is unchanged
Assignment is also a copy of the
Two types of copies
Numeric string
Another category:
List Dictionary tuples
This class is divided into two layers.
:
The memory address is not changed when the value is assigned
:
But the memory address changes when the shades are copied.
:
Saves memory space, regardless of whether a deep copy eventually points to a referenced value
:
Even if the deep copy, his address changed.
:
But all he's changed is a quoted address.
:
The specific value is also a
:
He just copied a copy of the quote.
:
Do you know what a reference to a list dictionary tuple is?
:
It's their index.
:
Index
0-256 number has a pool, so every time to take data do not have to open up memory, go directly to the pool to fetch, very fast!
Default Dictionary exercises:
From collectionsImport Defaultdict #导入模块
values=[11,12,13,18,30,50,80,100,85,90, 91,92,95]
dict= Defaultdict (list) #设置成默认列表
for Value in values:
66:
Dict[ ' K1 ']. Append (value) #只有列表才有append方法
else:
Dict[ K2 '].append (value)
print (dict)
Python Basics 0-4