>>> range(1,20) #代表从1到20(不包含20)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> range(1,20,3) #代表从1到20,间隔3(不包含20)
[1, 4, 7, 10, 13, 16, 19]
>>> range(1,20,4) #代表从1到20,间隔4(不包含20)
[1, 5, 9, 13, 17]
>>> range(20) #代表从0到20(不包含20)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
网友评论