📜  python 并行列表理解 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:19.232000             🧑  作者: Mango

代码示例1
# Use zip() to generate an single iterable from 2 lists:

zip([1, 2, 3], ["a", "b", "c"]) >> [(1, "a"), (2, "b"), (3, "c")]

example:

xs = [some list]
ys = [some other list]
func(x,y): return some value

[func(x, y) for x, y in zip(xs, ys)]

will iterate over both lists simultaneously, running func() over
each pair of values