标签:pre image mic strong ack tar python https http
range() 说是一个函数,准确来说,是一个类
range(start, stop[, step]) 左开右闭,不包括stop的值
>>>range(10) # 从 0 开始到 10
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range(1, 11) # 从 1 开始到 11
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> range(0, 30, 5) # 步长为 5
[0, 5, 10, 15, 20, 25]
>>> range(0, 10, 3) # 步长为 3
[0, 3, 6, 9]
>>> range(0, -10, -1) # 负数
[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
>>> range(0)
[]
>>> range(1, 0)
[]
转至:https://www.runoob.com/python/python-func-range.html
标签:pre image mic strong ack tar python https http
原文地址:https://www.cnblogs.com/xiaofeng91/p/12051962.html