python exec内置函数解析python代码

  • Post author:
  • Post category:python


 code_str = """
#coding: utf-8
binlog_source = {
'db' : 'binlog',
'table': 'canal_canal_st',
}
use_global_id = True
logical_table_list = ['applybinlog']
    """
    glo = {}
    loc = {}
    exec(code_str, glo, loc)
    print loc.keys()



版权声明:本文为zhu_19930414原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。