Page 24 - Python Cơ Bản
P. 24

try:

               array[index]

           except IndexError:
               # handle this







                   /MВQ XVE XLIS KMɨ XVК




          ɇВ OMВQ XVE QШX KMɨ XVК Gɹ XТR XϰM   OLɺRK XТR XϰM XVSRK


          QϲRK LE] OLɺRK XLɳ Gɹ XLВ Wм HдRK XSɨR Xм  in     not in   :ɴ


          Hд






           mylist = ['a', 'b', 'c']



           print 'a' in mylist

           (HiӅn thӍ True)



           print 'b' not in mylist

           (HiӅn thӍ False)





                 8VɴGL \YϴX QϲRK GSR





          8š˜RK Xр RLš GLYЦM  Xɹ XLВ XϰS GɨG QϲRK GSR XLɺRK UYE

          XSɨR Xм Pϴ] OLSϲR  [start:end]   VERKI   1ІG чКRL  start  Pɧ
   19   20   21   22   23   24   25   26   27   28   29