if a != None:

>>> x = 1 >>> not x False >>> x = [ 1 ] >>> not x False >>> x = 0 >>> not x True >>> x = [ 0 ]     # You don't want to fall in this one. >>> not x False   在python中 None, False, 空字符串"", 0, 空列表[], 空字典{}
相關文章
相關標籤/搜索