【发布时间】:2013-05-02 06:21:52
【问题描述】:
我想模板化一些配置文件,但它们与 python 的不兼容
"this is a {template}".format(template='string') 格式化
例如。花括号是配置(nginx 配置)的一部分。
你能把分隔符改成别的吗?
例如,'this is a [template]'.format(template='string')
【问题讨论】:
-
AFAIK,覆盖 format() 方法并非不可能。