I'd like to template out some config files, but they are not compatible with python's "this is a {template}".format(template='string')
formatting
eg. curly braces are part of the config (nginx config).
Can you change the delimiters to something else?
eg, 'this is a [template]'.format(template='string')
解决方案是使用string.Template
,并记住转义所有$
的http://docs.python.org/2/library/string.html#template-strings
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.