1.理解索引這個(gè)會(huì)在之后經(jīng)常用到
2.定義字符串、例如:str1 = 'http://www.itdecent.cn/u/a987b338c373'字符串內(nèi)容為自己的首頁(yè)連接,輸出自己的簡(jiǎn)書(shū)id(u/之后的內(nèi)容--a987b338c373)
str1 = 'http://www.itdecent.cn/c/c88fe7029f28';
print(str1[25:len(str1)])
3.設(shè)s = "abcdefg", 則下列值為
s[3]? ? d? ? ? ? ? s[2:4]? cd
s[:5]? ? abcde? ? ? ? ? s[3:]? defg
s[::-1]? gfedcba? ? ? ? ? s[::2] aceg
4.定義列表:list1 = [1,2,3,4,5,6,7],則下列值為
list1[3]? ? 4? ? ? ? list1[2:4] 3,4
list1[:5]? ? 12345? ? ? list1[3:]? 4,5,6,7
list1[::-1]? ? ? ? list1[::2]
5.定義元組:touple1 = (1,2,3,4,5,6,7),則下列值為
touple1[3]? ? 4? ? ? touple1[2:4]? 3,4
touple1[:5]? ? 12345? ? touple1[3:]? 4,5,6,7
touple1[::-1]? 7654321? ? touple1[::2] (1, 3, 5, 7)
6.對(duì)之前學(xué)習(xí)過(guò)得集中基本類型及其方法進(jìn)行復(fù)習(xí),重中之重理解索引和切片