Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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; 'argument': 0.04; 'string.': 0.04; 'builtin': 0.07; 'parameter': 0.07; 'subject:Error': 0.07; 'advice.': 0.09; 'formatted': 0.09; 'method:': 0.09; 'subject:()': 0.09; 'subject:messages': 0.09; 'cc:addr:python-list': 0.10; 'clear.': 0.16; 'curly': 0.16; 'sequence.': 0.16; 'str.format()': 0.16; 'wrote:': 0.17; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'object,': 0.27; 'dictionary': 0.29; 'function': 0.30; 'url:python': 0.32; 'docs': 0.33; 'list': 0.35; 'built-in': 0.35; 'sequence': 0.35; 'pm,': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'subject:: ': 0.38; 'url:docs': 0.38; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'first': 0.61; 'url:%20': 0.63; 'more': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'received:74.208.4.194': 0.84; 'url:functions': 0.84 Date: Tue, 13 Nov 2012 16:18:07 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: "Colin J. Williams" Subject: Re: Error messages from format() References: <50a293a0$0$29999$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:vWET/l8wQpusbu+TUv5WPg/y6v/WjZK/rvs2wWN4hwy XTLawprGIKDCToI3o2JRDnvqTKYDiDuSHB7Sq+a8u47njTuP54 fpXmcIYXA8nz13S7vXBvGYrHTYdXooyKo7cKvVpg+TYP8Ki6NX 9yMC3MugTUtSHLAnYnWLylG6TuNI6aeq1BHleCdaF40a5QRLHx Ytt0/YWFTIcvZKaW+NYqrm8eXb5kkmqyNHNFNb7xFJ4HhmBCPo xRewWvFQNTG05t/K+Xd7sFhEslbWtWMJnrnKnNy2oNLVwERe0g pbAxMyV4Hqa7cJ8RiygBDDQgOHlYDkHM7GaAfghPdlwVWIogQ= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352841512 news.xs4all.nl 6894 [2001:888:2000:d::a6]:49268 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33265 On 11/13/2012 03:24 PM, Colin J. Williams wrote: > > > I am working on the assumption that the first argument of the format > builtin function and be a sequence of values, which can be selected > with {1:}, {2:}, {0:} etc. > > The docs don't make this clear. I would appreciate advice. > The built-in function format(): http://docs.python.org/3.3/library/functions.html?highlight=format%20builtin#format The first parameter is a single object, NOT a sequence. One object, one format. If you want more generality, use the str.format() method: http://docs.python.org/3.3/library/stdtypes.html?highlight=format#str.format where you can supply a list or a dictionary of multiple items to be formatted into a single string. That's the one where you supply the curly braces. -- DaveA