kindle manager
This commit is contained in:
39
tdict.py
Normal file
39
tdict.py
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
|
||||
#############################################
|
||||
## PROGRAM: tdict.py
|
||||
## AUTHOR: Chengan 20200526
|
||||
## douboer@gmail.com
|
||||
## test multi-key dict
|
||||
#############################################
|
||||
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
||||
t = {'a':{'b':{'c':1}}}
|
||||
t['a']['b']['c']=2
|
||||
t['a']=2
|
||||
print(t)
|
||||
|
||||
t1 = {'a':{'b':{'c':'3'}}}
|
||||
t2 = t1
|
||||
print(t2)
|
||||
|
||||
t3 = {'b':{'c':'4'}}
|
||||
t4 = defaultdict(dict)
|
||||
t4['a'] = t3
|
||||
print(t4)
|
||||
|
||||
t4['a1']['b2'] = {'c3':'5'}
|
||||
print(t4)
|
||||
t4['a1']['d2'] = {'c3':'6'}
|
||||
print(t4)
|
||||
t4['a1']['e2'] = {'c3':'7'}
|
||||
print(t4)
|
||||
|
||||
t4['b1']['b2'] = {'b5':1}
|
||||
print(t4)
|
||||
|
||||
t4['b1']['b2']['b3'] = {'b5':1}
|
||||
print(t4)
|
||||
|
||||
Reference in New Issue
Block a user