只有if a = [result for x in y if cond] #cond=结果 result返回值 if-else a = [result if cond else result2 for x in y ]