Python的range(n)的用法 |
您所在的位置:网站首页 › n是正数什么意思 › Python的range(n)的用法 |
Python的range(n) 方法就是: API定义: If you do need to iterate(迭代) over a sequence(一系列) of numbers, the built-in function range() comes in handy(方便的). It generates arithmetic progressions 如果确实需要迭代一组数字,那么内置函数range()就派上用场了。它生成算术级数。 个人:就是range(数字n),获取长度为数字n的tuple(元组)集合,可以通过list(tup)将元组转为list列组 例如: 1 range(10)表示: range(0, 10) 2 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |