更快的方式来做到这一点...... [英] Faster way to do this...

查看:71
本文介绍了更快的方式来做到这一点......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:


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

推荐答案

Harlin Seritt写道:
Harlin Seritt wrote:
我有以下代码:

nums = range(0)
范围内(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?




这不等于简单......


nums = range(100)


McGugan将



Isn''t that equivalent to simply..

nums= range(100)

Will McGugan


Harlin Seritt写道:
Harlin Seritt wrote:
我有以下代码:

nums = range(0)
for a范围(100):
nums.append(a)

有没有更好的wa是否将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?



为什么不是最简单的解决方案?


a =范围(100)


问候

Steve


Why not the simplest solution?

a = range(100)

regards
Steve


Harlin Seritt写道:
Harlin Seritt wrote:
我有以下代码:

nums = range(0)
范围内(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?




你的意思是这样的吗? />

nums =范围(100)

;-)

-

----------------------------------------------- ---------------------

Aaron Bingham

软件工程师

Cenix BioScience GmbH

---------------------------------------- ----------------------------



You mean like this?

nums = range(100)

;-)

--
--------------------------------------------------------------------
Aaron Bingham
Software Engineer
Cenix BioScience GmbH
--------------------------------------------------------------------


这篇关于更快的方式来做到这一点......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆