python tips
1.字符串当变量名
exec(‘abc = 5’)
globals()[‘abc’] = 6
setattr(builtins, ‘abc’, 9)
import(‘sys’)._getframe(0)
四种都可以实现,那么,对于引用a如何得到{“c”:1},
>>> a=’bbb’
>>> bbb={“c”:1}
>>> exec(‘a=%s’ % a)
>>> a
{“c”: 1}
参考https://groups.google.com/forum/#!topic/python-cn/njvNp-1Fhrc
2.not all arguments converted during string formatting python
打印的时候%不对或者没有%