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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -