📅  最后修改于: 2022-03-11 14:46:31.935000             🧑  作者: Mango
代码示例1
>>> l = [1, 2, 3, 4, 5]
>>> ['yes' if v == 1 else 'no' if v == 2 else 'idle' for v in l]
['yes', 'no', 'idle', 'idle', 'idle']