python 三元运算

C:UsersAdministrator>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a,b,c=1,3,5
>>> d = a if a > b else c
>>> d
5
>>> d = a if a < b else c
>>> d
1
>>>

原文地址:https://www.cnblogs.com/ajaxa/p/6248995.html