python-三元运算

if 3 == 3:
name = "nginx"
else:
name = "tomcat"
print(name)
# nginx

#######################
# 上边的判断句和下面的是一个意思

name = "nginx" if 3 == 3 else "tomcat"


print(name)
# nginx
posted @ 2018-12-04 16:09  运维小菜鸟的开发之路  阅读(196)  评论(0编辑  收藏  举报