我的views.py上有一個defaultdict:輸出:
defaultdict(<class 'list'>, {'List of tubes': ['2324', '98', '7654', 'List of auto:': [147, 10048, 1009, 10050, 10, 1647, 10648, 649, 1005]})
我怎樣才能給我的 defaultdict 一個更好的結構?
像這樣 :
list of tube :
2324
98
7654
list of auto :
147
10048
1009
10050
10
1647
10648
649
1005
uj5u.com熱心網友回復:
d = defaultdict(list)
d['List of tubes'] = ['2324', '98', '7654']
d['List of auto'] = [147, 10048, 1009, 10050, 10, 1647, 10648, 649, 1005]
for key, value in d.items():
print(key)
for i in value:
print(i)
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/433893.html
上一篇:HTML電子郵件按鈕
