python判断变量名是否存在

try:
    var_name   
except NameError:
    var_name = initialize

posted @ 2022-11-13 22:36  dlhl  阅读(58)  评论(0)    收藏  举报