问题描述
我有以下代码:
nums = range(0)
for a range(100):
nums.append(a)
有没有更好的方法将num初始化为100个
连续int值列表?
谢谢,
哈林
I''ve got the following code:
nums = range(0)
for a in range(100):
nums.append(a)
Is there a better way to have num initialized to a list of 100
consecutive int values?
Thanks,
Harlin
推荐答案
这不等于简单......
nums = range(100)
McGugan将
Isn''t that equivalent to simply..
nums= range(100)
Will McGugan
为什么不是最简单的解决方案?
a =范围(100)
问候
Steve
Why not the simplest solution?
a = range(100)
regards
Steve
你的意思是这样的吗? />
nums =范围(100)
;-)
-
----------------------------------------------- ---------------------
Aaron Bingham
软件工程师
Cenix BioScience GmbH
---------------------------------------- ----------------------------
You mean like this?
nums = range(100)
;-)
--
--------------------------------------------------------------------
Aaron Bingham
Software Engineer
Cenix BioScience GmbH
--------------------------------------------------------------------
这篇关于更快的方式来做到这一点......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!