python range( )函数,,v=range(n)
python range( )函数,,v=range(n)
v=range(n),表示创建的范围是0-(n-1)
v=range(m,n,a),表示创建的范围为m-(n-1),步长为a
在python3中,序列刚创建时,每一个单个的值并没有在内存中存在,进行循环时才会在内存中一个一个创建,而在python2中,序列刚创建时就在内存中存在
0 2 4 6 8 [[email protected] test]# cat range.py v1=range(10)for item in v1: print(item,end=‘ ‘)print(‘‘)v2=range(0,10,2)for item in v2: print(item,end=‘ ‘)print(‘‘)[[email protected] test]# python range.py 0 1 2 3 4 5 6 7 8 9 0 2 4 6 8
python range( )函数
相关内容
- python-----05(多进程),,1. Mult
- python3.7.3使用web.py报错解决办法 and RuntimeError: generator
- python3和python2安装使用salt-api详解,,序言 最近在使
- python调用虹软2.0(全网首发)-更新中,,python调用虹软
- 初学Python——第一节课,,一、Python语言
- Python进阶编程 面向对象,,一.面向对象1.1面
- python xlsxwriter写excel并操作各种格式属性,, 1 # -*- c
- Python 字典,,a=dict(k1=
- Python_函数,,函数函数的定义:函数
- 涂色问题(Python),,题目:将一个圆形等分
评论关闭