Pass each element of a list to a function that takes multiple arguments in Python?

后端 未结 2 1035
情歌与酒
情歌与酒 2020-12-10 15:41

For example, if I have

a=[[\'a\',\'b\',\'c\'],[1,2,3],[\'d\',\'e\',\'f\'],[4,5,6]]

How can I get each element of a to be an argume

相关标签:
2条回答
  • 2020-12-10 16:22

    Chain()?

    http://docs.python.org/library/itertools.html#itertools.chain

    nm, read it wrong. That won't work.

    0 讨论(0)
  • 2020-12-10 16:27

    Using sequence unpacking (thanks to delnan for the name):

    zip(*a)
    
    0 讨论(0)
提交回复
热议问题