元組索引&截取示例【每日一個(gè)知識點(diǎn)第328期-Python】
元組索引&截取
L = ('spam', 'Spam', 'SPAM!'); print L[2]; #'SPAM!' print L[-2]; #'Spam' print L[1:]; #['Spam', 'SPAM!']
元組索引&截取
L = ('spam', 'Spam', 'SPAM!'); print L[2]; #'SPAM!' print L[-2]; #'Spam' print L[1:]; #['Spam', 'SPAM!']