0

这有可能作为列表理解吗?

points = []
for partial in partials:
    for point in partials[partial]:
        if point[0] == time:
            points.append(partial)

在python3中?

谢谢,

巴里

4

1 回答 1

4

Yes.

points = [partial
          for partial in partials
          for point in partials[partial]
          if point[0] == time]

(Not sure what this is useful for, but at least this will do the same as your original code.)

于 2012-04-12T15:42:14.393 回答