判断变量是否存在(python)时间:2022-10-21 04:32:13var = 1 # print True print 'var' in dir() # print False print 'va' in dir() # work for list , dict too