Python 3 将范围转换为列表 - Python 3 turn range to a list

10/14 07:58
阅读数 0

问题:

I'm trying to make a list with numbers 1-1000 in it.我正在尝试制作一个包含数字1-1000的列表。 Obviously this would be annoying to write/read, so I'm attempting to make a list with a range in it.显然,写/读会很烦人,所以我试图制作一个包含范围的列表。 In Python 2 it seems that:在 Python 2 中,似乎:

some_list = range(1,1000)

would have worked, but in Python 3 the range is similar to the xrange of Python 2?会起作用,但是在 Python 3 中的范围类似于 Python 2 的xrange

Can anyone provide some insight into this?任何人都可以对此提供一些见解吗?


解决方案:

参考一: https://en.stackoom.com/question/mATy
参考二: https://stackoom.com/question/mATy
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部