python判断一个对象是否为空的方法

判断对象是否为空: spa 复制代码 代码以下: >>> eth = {"eth0″:"192.168.1.1″} >>> any(eth) True >>> eth = {} >>> any(eth) False 判断list是否为空code 传统的方式: orm 复制代码 代码以下: if len(mylist):     # Do something with my list else:  
相关文章
相关标签/搜索