Zip lists in Python

前端 未结 10 2082
无人及你
无人及你 2020-11-22 02:09

I am trying to learn how to \"zip\" lists. To this end, I have a program, where at a particular point, I do the following:

x1, x2, x3 = stuff.calculations(wi         


        
10条回答
  •  无人及你
    2020-11-22 02:43

    zip takes a bunch of lists likes

    a: a1 a2 a3 a4 a5 a6 a7...
    b: b1 b2 b3 b4 b5 b6 b7...
    c: c1 c2 c3 c4 c5 c6 c7...
    

    and "zips" them into one list whose entries are 3-tuples (ai, bi, ci). Imagine drawing a zipper horizontally from left to right.

提交回复
热议问题