本文介绍了Python 2 和 Python 3 中 zip() 函数的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道 python 2 和 python 3 中的 zip()
函数之间的区别是什么.我注意到在这两个函数上使用 timeit
模块时,python 3 函数要快得多.非常感谢 :)
I was wondering what the difference is between the zip()
function in python 2 and python 3 is. I noticed when using the timeit
module on both functions that the python 3 function was a lot faster. Thanks so much in advance :)
推荐答案
Python 2 和 Python 3 的区别在于 Python 3 返回一个迭代器.这种节省内存的想法.
Difference between Python 2 and Python 3 is Python 3 returns an iterators. Idea of this saving memory.
这篇关于Python 2 和 Python 3 中 zip() 函数的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!