列表生成式的语法:
#循环for... in...一次,执行一次expression表达式,
#for in 循环,满足condition条件判断,执行左侧expression
[expression for item1 in iterable1 if condition1
for item2 in iterable2 if condition2
...
for itemN in iterableN if conditionN
]
类似于
res=[] for item1 in iterable1: if condition1: for item2 in iterable2: if condition2 ... for itemN in iterableN: if conditionN: res.append(expression)