Python 3 vs Python 2 map behavior

前端 未结 4 703
耶瑟儿~
耶瑟儿~ 2020-12-09 04:00

In Python 2, a common (old, legacy) idiom is to use map to join iterators of uneven length using the form map(None,iter,iter,...) like so:

4条回答
  •  庸人自扰
    2020-12-09 04:26

    you can solve the problem like this: list(map(lambda x, y: (x, y),[1, 2, 3 ,4, 5], [6, 7, 8, 9, 10]))

提交回复
热议问题