On Mon, Apr 21, 2014 at 8:34 AM, Mariano DAngelo <marianoa.dang...@gmail.com> wrote: > And I want to format like this: > > context = { > "project_name":project_name, > "project_url":project_url, > } > > nginx_conf.format(**context) > > > but since the string have { i can't. > Is there a way to solve this?
Are you in full control of the source string? You can escape the braces as explained here: https://docs.python.org/3.4/library/string.html#format-string-syntax If you're not in full control (eg if it comes from a user's input), or if you don't like the idea of doubling all your braces, you could switch to percent-formatting, or some other form of interpolation. But the easiest would be to simply escape them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list