【Python】列表推导式

1. 列表推导式

list1 = [1, 3, 5, 6, 8]
list2 = [x * 2 for x in list1]

print(list2)
# [2, 6, 10, 12, 16]
相关文章
相关标签/搜索