Python 条件判断的缩写方法
分类:Python
标签Tags:python,条件,判断,缩写,方法,return,easy,god,c,用法,写的,print,fool,not,bad,输出,结果
return (1==1) ? "is easy" : "my god" //C#中的用法
其实,在Python中,是这样写的:
print (1==2) and 'Fool' or 'Not bad'
输出结果:
Not bad
以上就是【Python 条件判断的缩写方法】的全部内容了,欢迎留言评论进行交流!