python : template var without space -
in python, try use templates
string import template s = template("hello $world") print s.substitute(world="stackoverflow") ok, but, in template need concatenate string without space, example
s = template("a small number : $number e6") print s.substitute(number=5) i need a small number : 5e6 output, without white space between 5 , e6.
use curly braces around pattern:
template("a small number : ${number}e6") result:
>>> template("a small number : ${number}e6").substitute(number=5) 'a small number : 5e6'
Comments
Post a Comment