python判断字典,列表,元组为空的方法。

m1 = []
m2 = ()
m3 = {}
判断他们为空的方法是什么?
if m1:
    非空

else:

   空
if not m2:
   空

else:

   非空


False,0,'',[],{},()都可以视为假

你可能感兴趣的:(Mysql相关,python)