列表生成 # -*- coding: utf-8 -*- # data =[1,2,3] # for index,i in enumerate(data): # print (index,i) # data[index]=i+1 # print(data) ###列表生成式 # data =[1,2,3] # data = [i+1 for i in data] # print(data) ###三元运算的方式列表生成式 data=[1,2,3,4,5,6,7] data= [i*2 if i>…