7python ruturn中的and与or.

def test():
a = ""
return a or "hehe" #如果a为真,输出a; 否则输出右边(比如0, "", [], ())
   #return a or None
print(test())

https://www.cnblogs.com/zealousness/p/8749152.html
posted @ 2019-05-08 20:43  心媛意码  阅读(195)  评论(0编辑  收藏  举报