Page 31 - Python Cơ Bản
P. 31
point = {'x': 1, 'y': 2}
8VY] \YϴX QШX KMɨ XVК HрE ZɧS OI] GжE чРM XвRK :ɴ Hд
point = {'x': 3, 'y': 6, 'z' : 9}
print point[x]
(HiӅn thӍ 3)
8LɱQ QШX TL϶R Xм
ɇВ XLɱQ QШX TL϶R Xм ZɧS чРM XвRK чɪ OLEM FɨS Wм HдRK
GϴY XVɾG dict[key] = value :ɴ Hд
user = {'name': 'Jone', 'age': 30}
user['country'] = 'Vietnam'
print user
(HiӅn thӍ {'country': 'Vietnam', 'age': 30, 'name':
'Jone'})
1ШX WР LɧQ TLRK XLиG XLɺRK HдRK
dict.clear() <ɹE XSɧR FШ Hо PMЖY FɱR XVSRK чРM