在lua中通过loadfile, setfenv实现)
python:
cat config.py bar = 10 foo=100 cat python_as_config.py: ns = {} execfile('config.py', ns) print "\n".join(sorted(dir(ns))) print "*"*80 print ns['foo'] print ns['bar']
缺点是不像lua那么可以以成员的方式访问table中的变量,如ns.foo, ns.bar... HdhCmsTestbitsCN测试数据
查看更多关于python代码制作configure文件示例的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did90266