Skip to content

Commit 25bfb1f

Browse files
authored
Create dict_note
1 parent 47f41b9 commit 25bfb1f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dict_note

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
使用dict.fromkeys(range(100),[])初始化时 用append改编其中一个值其他的值也跟着改变 ————所以元素的地址全都指向一个[]
2+
避免这种错误的方法 使用推导式初始化———— {k:[] for k in range(100)}
3+

0 commit comments

Comments
 (0)