How would you zip an unknown number of lists in Python?

前端 未结 1 700
無奈伤痛
無奈伤痛 2020-12-10 23:57

Let\'s say I have the following lists:

assignment = [\'Title\', \'Project1\', \'Project2\', \'Project3\']
grades = [ [\'Jim\', 45, 50, 55], \\
           [\'         


        
1条回答
  •  悲哀的现实
    2020-12-11 00:34

    You can use * to unpack a list into positional parameters:

    zip(assignment, *grades)
    

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