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  TLš˜RK XLиG XLɺRK HдRK





                   dict.clear()   <ɹE XSɧR FШ Hо PMЖY FɱR XVSRK чРM
   26   27   28   29   30   31   32   33   34   35   36