我是一名 Sharpist,他定期使用 Python 来格式化文本......然后突然出现这样一种情况,即 Python(即使在重新安装之后)现在将范围视为一个类,而没有将我的数组返回给我......为什么?图塔控制台
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> range(100,0,-1)
range(100, 0, -1)
>>> type(range(100))
<class 'range'>
因为在 3.x 版本中。这是对象。要获取列表,您需要: