Python zip() 函数

最近使用zip函数时出现了一些错误,简单记录一下。有错误的地方,欢迎大佬批评。

初始化几个列表
Python zip避坑
输出结果:
Python zip避坑

zip基本用法:从多个列表中各自依次取出一个元素组合,组合后的元素个数为较短数组中元素个数

Python zip避坑
输出结果:
Python zip避坑
避坑1:无法直接使用print(C)打印
Python zip避坑
输出结果:
Python zip避坑
避坑2:zip返回的是一个迭代器
Python zip避坑
输出结果:
Python zip避坑

python中的函数还有很多,日后慢慢学习。

相关文章:

  • 2021-09-16
  • 2022-12-23
  • 2021-07-06
  • 2021-09-19
  • 2021-06-16
  • 2021-07-05
  • 2021-06-23
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2021-11-10
  • 2021-06-22
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2021-06-26
相关资源
相似解决方案