码迷,mamicode.com
首页 > 编程语言 > 详细

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

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

标签:and   元组   style   font   tuple   (())   之间   注意   连接   



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

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

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

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

标签:and   元组   style   font   tuple   (())   之间   注意   连接   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!