小编SÜM*_*ÇAK的帖子

string.format与css标签结合:{}的

这是我在html模板中替换变量的方法

a1 = '<html><title>{0}</title><body>{1}</body></html>'
 vars = ['test', 'test']
 output = a1.format(*vars)
Run Code Online (Sandbox Code Playgroud)

问题是..当html中有css时,这与css标签冲突.

因为css包含:

 {}'s
Run Code Online (Sandbox Code Playgroud)

html python python-2.7

7
推荐指数
1
解决办法
1554
查看次数

标签 统计

html ×1

python ×1

python-2.7 ×1