元组索引&截取示例【每日一个知识点第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!']