python: 判断tuple、list、dict是否为空的方法
2018-10-22 09:19
3279 查看
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是否为空的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
相关文章推荐
- Python教程学习简记1--Python数据类型和变量 字符串和编码 list和tuple 条件判断 循环 dict和set
- python通过字典dict判断指定键值是否存在的方法
- Python基础(二)List和tuple、条件判断、dict和set
- Python 中的None以及 == 与 is 的区别,以及判断某个list或者dict元素是否为None
- python31初级[list+tuple+set+dict+str+file的成员方法]
- python基本数据类型list,tuple,set,dict用法以及遍历方法
- python基础31[list+tuple+set+dict+str+file的成员方法]
- python的id(),list(),dict(),tuple()等方法
- python学习系列---list,tuple,dict,set内置方法
- python学习系列---list,tuple,dict,set内置方法
- Python入门(三)——list和tuple,条件判断和循环,dict和set
- Python3学习笔记【基础3--list,tuple,if条件判断,for/while循环,dict字典,set集合】
- python isinstance(), stack,判断list, dict, tuple为空
- Python教程学习简记1--Python数据类型和变量 字符串和编码 list和tuple 条件判断 循环 dict和set
- python数据类型dict、list、str、tuple互换方法
- Python【基础:数据类型和变量 字符串和编码 list和tuple 条件判断 循环 dict和set】注意事项(与java,c比较)
- 自学python(03)list和tuple,条件判断和循环,dict和set
- Python入门(三)——list和tuple,条件判断和循环,dict和set
- python基础31[list+tuple+set+dict+str+file的成员方法]
- Python tricks(3) -- list和dict的遍历和方法