1
在Python中,我嘗試使用的模板蟒蛇:模板無功不受空間
from string import Template
s = Template("hello $world")
print s.substitute(world="Stackoverflow")
不錯,但,在模板中,我需要拼接無空格的字符串,例如
s = Template("a small number : $number e6")
print s.substitute(number=5)
我需要a small number : 5e6
爲輸出,沒有5和e6之間的空白。