代码改变世界

Python三元运算

2018-04-10 20:45  钱先生  阅读(200)  评论(0编辑  收藏  举报
1 result = 值1 if 条件 else 值2

如果条件为真,result = 值1

如果条件为假, result = 值2.