当前位置: 首页 > news >正文

python range()函数

python range()函数

python3 range()生成一个迭代对象

 1 def test_range():
 2     range_res = range(0, 5, 1)
 3     return range_res
 4 
 5 
 6 if __name__ == '__main__':
 7     res = test_range()
 8     for n in res:
 9         print(n)
10     print(list(res))