Python, Template from string, save 'bool' type -
i use template string, example:
from string import template s = template(u'(true, $type)') res = s.substitute(type={'type': bool}) print res output:
(true, {'type': <type 'bool'>}) but, need:
(true, {'type': bool}) how can this?
try this:
>>> res = s.substitute(type="{'type': bool}") >>> res u"(true, {'type': bool})"
Comments
Post a Comment