QQ扫一扫联系
以下哪个选项不能生成列表['data1', 'data3', 'data5', 'data7', 'data9'] ?
list1 = [] for i in range(1,10,2): list1.append("data{}".format(i)) print(list1)
list2 = [ "data{}".format(i)for i in range(1,10,2)] print(list2)
list3= [] for i in range(10): if i %2 == 1: list3.append("data{}".format(i)) print(list3)
list4 = [ "data{}".format(i) for i in range(0,10) if i % 2 == 0] print(list4)