listone = [2, 3, 4] listtwo = [2*i for i in listone if i > 2] print(listtwo)
[6, 8]
[mapping-expression for element in source-list if filter-expression]
mapping-expression
element
source-list
filter-expression
沒有留言:
張貼留言