读书人

python通用的列表解析构造

发布时间: 2012-08-22 09:50:35 作者: rapoo

python通用的列表解析结构

通用的列表解析结构如下:

[expression for target1 in iterable1 [if condition1]

? ?for target1 in iterable2 [if condition2]

? ?for target1 in iterable3 [if condition3]

? ?for target1 in iterable4 [if condition4]

? ?... .... ... .... ... ... ... ... ... ... ... ... ... ... .

??for targetN in iterableN [if conditionN]]

例如:

?

print rs == rx #True
?

读书人网 >perl python

热点推荐