三元运算

 

1
result = 1 if 条件 else 2

如果条件为真:result = 值1
如果条件为假:result = 值2

posted @ 2018-11-04 10:29  rongye  阅读(125)  评论(0编辑  收藏  举报