语法
range(star ,end, step) # start默认为0,step默认为1
range(star, end) #默认step为1
range(end) # 默认了star为0,step 为0
示例
>>>list(range(1, 20, 2))
[1,3,5,7,9,11,13,15,17,19]
>>>list(range(1,20))
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
>>>list(range(20))
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
网友评论