Python 三元表达式

Posted by 4Aiur on 12/06/2010 in Python |

Python 三元表达式

In [1]: x = 100 if True else 200

In [2]: x
Out[2]: 100

In [3]: x = 100 if False else 200

In [4]: x
Out[4]: 200

Tags:

Copyright © 2010-2024 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.