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


Groups > comp.lang.python > #92351

Re: Cheat sheet for the new string formatting?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'ignored': 0.05; 'formatting': 0.07; 'brackets': 0.09; 'forcing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'python': 0.11; 'braces,': 0.16; 'dots': 0.16; 'fancy': 0.16; 'formatting.': 0.16; 'knight': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; 'string': 0.17; 'skip': 0.18; 'examples': 0.18; 'language': 0.19; 'thanks,': 0.19; 'lawrence': 0.22; '2015': 0.23; '(you': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'figure': 0.27; 'perl': 0.29; 'maybe': 0.31; 'code': 0.31; 'language.': 0.32; 'ordered': 0.33; 'steven': 0.33; 'subject:?': 0.34; 'google': 0.34; 'to:addr :python-list': 0.35; 'but': 0.36; 'there': 0.36; 'thanks': 0.36; 'hi,': 0.37; 'should': 0.37; "didn't": 0.37; 'subject:: ': 0.37; 'received:org': 0.38; 'stuff': 0.38; 'pm,': 0.39; 'to:addr:python.org': 0.39; 'mark': 0.40; 'subject:the': 0.40; 'some': 0.40; 'our': 0.64; 'url:info': 0.71; 'pythonistas,': 0.84; 'doctor': 0.91; 'sheet': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Cheat sheet for the new string formatting?
Date Mon, 08 Jun 2015 23:20:07 +0100
References <CANc-5Uyv8Ma3G-JfRh7PT-yf4QzJaWnqgyYN9c8=mrnGx_5yRQ@mail.gmail.com> <cdede6267d6e8c525061570e6c355142@mail.knight.cx>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host host-92-24-221-219.ppp.as43234.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <cdede6267d6e8c525061570e6c355142@mail.knight.cx>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.306.1433802033.13271.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433802033 news.xs4all.nl 2874 [2001:888:2000:d::a6]:35445
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92351

Show key headers only | View raw


On 08/06/2015 21:05, Steven K Knight wrote:
>
>
> June 8 2015 3:11 PM, "Skip Montanaro" <skip.montanaro@gmail.com
> <mailto:%22Skip%20Montanaro%22%20<skip.montanaro@gmail.com>>> wrote:
>
>     I have so far ignored the new string formatting (you know, the stuff
>     with all the braces, dots and brackets that make Python strings look
>     like Perl code <wink>). I am still only using Python 2.7, but have
>     recently started forcing myself to use the print() function. I
>     figure maybe I should also start to come to grips with the fancy new
>     string formatting.
>
>     Is there a cheat sheet around which shows some side-by-side examples
>     of the {}-style and printf-style? I didn't see anything with a few
>     Google searches.
>     Thx,
>     Skip
>
>
> Hi,
>
> I think http://pyformat.info/ is what you're looking for.
>
> Thanks,
> ​
> --
> Steven Knight <steven@knight.cx <mailto:steven@knight.cx>>
>

Many thanks for the link, just what the doctor ordered :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Thread

Re: Cheat sheet for the new string formatting? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-08 23:20 +0100

csiph-web