站长资源脚本专栏

Python 条件判断的缩写方法

整理:jimmy2025/2/27浏览2
简介return (1==1) ? "is easy" : "my god" //C#中的用法 其实,在Python中,是这样写的: print (1==2) and 'Fool' or 'Not bad' 输出结果: Not bad
return (1==1) ? "is easy" : "my god" //C#中的用法
其实,在Python中,是这样写的:
print (1==2) and 'Fool' or 'Not bad'
输出结果:
Not bad