Dict
2021-08-07 00:00:00
初期化
d = dict() d = {"A":1, "B":2, "C":3} d = dict(zip(["A", "B", "C"], [1, 2, 3]))
ループ
for k, v in d.items(): print(k, v) for k in d.keys(): print(k) for v in d.values(): print(v)
追加
d["D"]=4 d1.update(d2)
削除
del d["B"] v = d.pop("A") d.clear()
その他
size = len(d) b = "B" in d b = "B" not in d l = list(d.keys()) l = list(d.values())