Re: how to string format when string have {

2014-04-21 Thread Chris Angelico
On Mon, Apr 21, 2014 at 6:51 PM, Peter Otten <__pete...@web.de> wrote: > Some regex gymnastics in the morning (not recommended): You ask me to believe that a regex would be the best solution here? There's no use trying; one CAN'T believe impossible things. ChrisA (There goes the shawl again!) --

Re: how to string format when string have {

2014-04-21 Thread Peter Otten
Chris Angelico wrote: > On Mon, Apr 21, 2014 at 8:34 AM, Mariano DAngelo > 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

Re: how to string format when string have {

2014-04-20 Thread Tim Chase
On 2014-04-20 15:34, Mariano DAngelo wrote: > I have the following string: ... > but since the string have { i can't. > Is there a way to solve this? I second Chris Angelico's suggestion about using the older percent formatting: nginx_conf = ''' server { listen 80; server_name dev

Re: how to string format when string have {

2014-04-20 Thread Chris Angelico
On Mon, Apr 21, 2014 at 8:34 AM, Mariano DAngelo 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

how to string format when string have {

2014-04-20 Thread Mariano DAngelo
I have the following string: nginx_conf = ''' server { listen 80; server_name dev.{project_url}; location / { proxy_pass http://127.0.0.1:8080; include /etc/nginx/proxy.conf; } location /media { alias /home/mariano/PycharmProjects/{project