Life is short, you need Python

条件判断缩写

>>> x=3
>>> y=4
>>> z=10 if x>y else 0
>>> z
0
>>> z=10 if x<y else 0
>>> z
10
>>>

True value if condition else False value

posted @ 2010-09-17 15:03  runfox545  阅读(341)  评论(0)    收藏  举报
白月黑羽 Python教程 白月黑羽Python