【Python】列表推导式
程序员文章站
2023-08-31 10:10:44
1. 列表推导式 ......
1. 列表推导式
list1 = [1, 3, 5, 6, 8] list2 = [x * 2 for x in list1] print(list2) # [2, 6, 10, 12, 16]
list1 = [1, 3, 5, 6, 8] list2 = [x * 2 for x in list1] print(list2) # [2, 6, 10, 12, 16]