python 列表综合的一个事例

#! f:\python
#Filename : list_comprehension.py


listone = [2,6,8]

listtwo = [2*i for i in listone if i>2]


print listone

print listtwo


输出:

>>> ================================ RESTART ================================
>>> 
[2, 6, 8]
[12, 16]

>>> 

猜你喜欢

转载自blog.csdn.net/u013531083/article/details/18792357