Python 中复合的 list comprehension


Author: yifei / Created: May 30, 2017, 9:17 p.m. / Modified: May 30, 2017, 9:17 p.m. / Edit

Python 中的 list comprehension 可以复合

[x for li in lists for x in li if x]

就相当于

[x
    for li in lists
        for x in li
             if x]

有任何问题可以发邮件到 kongyifei (at) gmail.com 讨论