python: list[-1] 与 list[-1:] 的区别

 1 >>> l
 2 '3.542485	1.977398	-1
'
 3 >>> l.split()
 4 ['3.542485', '1.977398', '-1']
 5 >>> l=l.split()
 6 >>> l[:2]
 7 ['3.542485', '1.977398']
 8 >>> l[2]
 9 '-1'
10 >>> l[:1]
11 ['3.542485']
12 >>> l[-1]
13 '-1'
14 >>> l[-1:]
15 ['-1']
原文地址:https://www.cnblogs.com/monne/p/4254671.html