2

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')

dreftymac
  • 31,404
  • 26
  • 119
  • 182
yarbelk
  • 7,215
  • 6
  • 29
  • 37

1 Answers1

4

The solution is to use string.Template, and remember to escape all the $'s http://docs.python.org/2/library/string.html#template-strings

yarbelk
  • 7,215
  • 6
  • 29
  • 37