初始化一个列表到一个已知的数在Python元件 [英] Initializing a list to a known number of elements in Python
本文介绍了初始化一个列表到一个已知的数在Python元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我使用的名单,并期待是这样的:
Right now I am using a list, and was expecting something like:
verts = list (1000)
我应该使用数组呢?
Should I use array instead?
推荐答案
这想到,我的第一件事是:
The first thing that comes to mind for me is:
verts = [None]*1000
但你真的需要preinitialize呢?
But do you really need to preinitialize it?
这篇关于初始化一个列表到一个已知的数在Python元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文