简体   繁体   English

可以压缩多个列表导致python 2.7中的性能问题吗?

[英]Can zipping multiple lists cause performance issue in python 2.7?

I have multiple lists in python which I zip as shown below. 我在python中有多个列表,如下所示。 My question is whether is this the best practice to do or is there any other effective way. 我的问题是这是最佳做法还是还有其他有效方法。 Secondly, will there be any performance issue if I zip multiple lists as shown below? 其次,如果我压缩多个列表,如下所示,会有性能问题吗?

biglist = zip(list1,list2,list3,list4,list5)

Depends on what you do with the result. 取决于您对结果的处理方式。 If you iterate over it once, itertools.izip would use less memory. 如果您对其进行一次迭代, itertools.izip将使用更少的内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM