2014-01-07 22:51:51 +00:00
|
|
|
d = {1:2, 3:4}
|
2014-04-06 19:28:44 +01:00
|
|
|
print(len(d))
|
2014-01-07 22:51:51 +00:00
|
|
|
d.update(["ab"])
|
|
|
|
print(d[1])
|
|
|
|
print(d[3])
|
|
|
|
print(d["a"])
|
|
|
|
print(len(d))
|
|
|
|
d.update([(1,4)])
|
|
|
|
print(d[1])
|
|
|
|
print(len(d))
|
2014-06-03 12:53:44 +01:00
|
|
|
|
|
|
|
# using keywords
|
|
|
|
d.update(a=5)
|
|
|
|
print(d['a'])
|
|
|
|
d.update([(1,5)], b=6)
|
|
|
|
print(d[1], d['b'])
|