Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70440

Re: how to string format when string have {

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'root': 0.05; 'context': 0.07; 'string': 0.09; 'alias': 0.09; 'subject:string': 0.09; 'cc:addr:python-list': 0.11; "'''": 0.16; '-tkc': 0.16; "can't.": 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'skip:/ 70': 0.16; 'string:': 0.16; 'subject:format': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'second': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'url:127': 0.31; 'older': 0.33; 'skip:d 20': 0.34; 'but': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'server': 0.38; 'solve': 0.60; 'to:addr:gmail.com': 0.65; 'url:0': 0.67; 'percent': 0.68; '500': 0.70; 'subject:have': 0.80; 'received:50.22': 0.84; 'expires': 0.91
Date Sun, 20 Apr 2014 18:43:44 -0500
From Tim Chase <python.list@tim.thechases.com>
To Mariano DAngelo <marianoa.dangelo@gmail.com>
Subject Re: how to string format when string have {
In-Reply-To <2075921a-dd3e-4788-86fb-e751ad98ee0e@googlegroups.com>
References <2075921a-dd3e-4788-86fb-e751ad98ee0e@googlegroups.com>
X-Mailer Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Get-Message-Sender-Via boston.accountservergroup.com: authenticated_id: tim@thechases.com
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9391.1398037431.18130.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398037431 news.xs4all.nl 2865 [2001:888:2000:d::a6]:39219
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70440

Show key headers only | View raw


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.%(project_url)s;
    location / {
        proxy_pass  http://127.0.0.1:8080;
        include     /etc/nginx/proxy.conf;
    }
    location /media  {
	alias /home/mariano/PycharmProjects/%(project_name)s/%(project_name)s/media;
        expires 30d;
    }
    location /static  {
	alias /home/mariano/PycharmProjects/%(project_name)s/%(project_name)s/static;
        expires 30d;
    }
    error_page   500 502  503 504  /50x.html;
    location =  /50x.html {
        root    html;
        }
}'''
context = {
 "project_name":project_name,
 "project_url":project_url,
 }

print(nginx_conf % context)

-tkc



Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to string format when string have { Mariano DAngelo <marianoa.dangelo@gmail.com> - 2014-04-20 15:34 -0700
  Re: how to string format when string have { Chris Angelico <rosuav@gmail.com> - 2014-04-21 08:41 +1000
  Re: how to string format when string have { Tim Chase <python.list@tim.thechases.com> - 2014-04-20 18:43 -0500
  Re: how to string format when string have { Peter Otten <__peter__@web.de> - 2014-04-21 10:51 +0200
  Re: how to string format when string have { Chris Angelico <rosuav@gmail.com> - 2014-04-21 18:56 +1000

csiph-web