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

 

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

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

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

猜你喜欢

转载自www.cnblogs.com/DDBD/p/12230201.html
今日推荐