首页 > 编程语言 > 详细

python 两个tuple元组之间连接判断是否有一个为空, and 和 & ,只能用and 不能用&

时间:2020-01-23 10:02:23      阅读:101      评论:0      收藏:0      [点我收藏+]


s=tuple((5,3,6))
r=tuple(())

if r and s: #注意这里只能用and ,如果用&则报错
print("sfafda")

但是
if tuple():
  pass
这个是可以的,如果空元组,是可以被判断出来的,,,,,

python 两个tuple元组之间连接判断是否有一个为空, and 和 & ,只能用and 不能用&

原文:https://www.cnblogs.com/DDBD/p/12230201.html

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