1[x for x in data if condition]#需求 1-10内奇数来个平方print([i**2for i inrange(11)if i%2==1])#[1, 9, 25, 49, 81]2[exp1 if condition else exp2 for x in data]#需求 1-10内奇数来个平方,偶数也要显示哦print([i**2if i%2==1else i for i inrange(1,11)])#[1, 2, 9, 4, 25, 6, 49, 8, 81, 10]