首页 > 编程语言 > 详细

python ruturn中的and与or.

时间:2019-05-08 21:19:42      阅读:139      评论:0      收藏:0      [点我收藏+]
def test():
a = ""
return a or "hehe" #如果a为真,输出a; 否则输出右边(比如0, "", [], ())
   #return a or None
print(test())

https://www.cnblogs.com/zealousness/p/8749152.html

python ruturn中的and与or.

原文:https://www.cnblogs.com/Stephen-Qin/p/10834530.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!