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
8RK 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ɧ