Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '%s"': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:gator410.hostgator.com': 0.09; 'skip:{ 20': 0.09; 'subject:string': 0.09; '~ethan~': 0.09; 'wrote:': 0.14; '"%s': 0.16; 'captured': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject:formatting': 0.16; 'mon,': 0.17; 'header:In-Reply-To:1': 0.21; 'wrote': 0.22; 'maybe': 0.23; 'steve': 0.24; 'print': 0.31; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.35; 'skip:" 10': 0.35; 'skip:{ 10': 0.35; 'message-id:': 0.36; 'subject:new': 0.37; 'subject:: ': 0.38; 'subject:with': 0.39; 'to:addr:python.org': 0.39; 'han': 0.65; 'received:websitewelcome.com': 0.67; 'received:69.93': 0.67; 'solo': 0.68; 'subject:local': 0.84 Date: Mon, 06 Jun 2011 11:57:36 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: python-list@python.org Subject: Re: new string formatting with local variables References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:4860 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307385872 news.xs4all.nl 49044 [::ffff:82.94.164.166]:54808 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7106 Steve Crook wrote: > On Mon, 6 Jun 2011 12:15:35 -0400, Jabba Laci wrote in > Message-Id: : > >> solo = 'Han Solo' >> jabba = 'Jabba the Hutt' >> print "{solo} was captured by {jabba}".format(solo=solo, jabba=jabba) >> # Han Solo was captured by Jabba the Hutt > > How about:- > > print "%s was captured by %s" % (solo, jabba) Or even print "{} was captured by {}".format(solo, jabba) or how about print "{victim} was captured by {captor}".format( victim=solo, captor=jabba) or maybe print "{hapless_twit} was captured by {mega_bad_dude}".format( hapless_twit=solo, mega_bad_dude=jabba) ~Ethan~