赞
踩
一般语言的三元表达式都是这种形式:
- result = statement ? true : false
-
- // For examle
- result = a > b ? a : b
Python中的三元表达式比较特殊,用下面这种形式
- result = true if statement else false
-
- # For example
- result = a if a > b else b
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。