Viv*_*vek 5 python range python-2.7 python-3.x
蟒蛇3:
string = range(10)
print("{}".format(type(string)))
Run Code Online (Sandbox Code Playgroud)
输出:
class 'range'
Run Code Online (Sandbox Code Playgroud)
我只是对这个类的“范围”感到好奇。谁能解释一下?
但是在 Python2 中:
输出:
class 'list'
Run Code Online (Sandbox Code Playgroud)
嗯,这是不言自明的
| 归档时间: |
|
| 查看次数: |
4678 次 |
| 最近记录: |