2014-01-07 17:51:51 -05:00
|
|
|
d = {1:2, 3:4}
|
2014-04-06 14:28:44 -04:00
|
|
|
print(len(d))
|
2014-01-07 17:51:51 -05: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 07:53:44 -04:00
|
|
|
|
|
|
|
# using keywords
|
|
|
|
d.update(a=5)
|
|
|
|
print(d['a'])
|
|
|
|
d.update([(1,5)], b=6)
|
|
|
|
print(d[1], d['b'])
|