当前位置: 移动技术网 > IT编程>脚本编程>Python > python: 判断tuple、list、dict是否为空的方法

python: 判断tuple、list、dict是否为空的方法

2018年11月08日  | 移动技术网IT编程  | 我要评论

殷桃的嘴,桂花栽培技术,浮沉2崔曼莉

test

tuple_test = ()
assert not tuple_test

list_test = []
assert not list_test

dict_test = {}
assert not dict_test

summary

根据实验结果可知,直接通过:

if not xxx:

即可判断 tuple、list、dict 是否 为空 。

以上这篇python: 判断tuple、list、dict是否为空的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网