Think before you speak, read before you think.

python any判断一个对象是否为空

any判断dict,list,tuple是不是为空

>>> eth = {“eth0″:”192.168.1.1”}

>>> any(eth)

True

>>> eth = {}

>>> any(eth)

False


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *