Python 条件判断的缩写方法
摘要:return(1==1)?"iseasy":"mygod"//C#中的用法其实,在Python中,是这样写的:print(1==2)and'...
return (1==1) ? "is easy" : "my god" //C#中的用法
其实,在Python中,是这样写的:
print (1==2) and 'Fool' or 'Not bad'
输出结果:
Not bad
【Python 条件判断的缩写方法】相关文章:
★ Python strip lstrip rstrip使用方法
上一篇:
Python 可爱的大小写
下一篇:
Python struct.unpack