Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'think,': 0.05; 'python': 0.08; 'received:64.4': 0.09; 'subject:string': 0.09; 'library': 0.15; '2.6,': 0.16; 'str.format()': 0.16; 'string:': 0.16; 'header :In-Reply-To:1': 0.21; 'parse': 0.23; 'versions': 0.23; 'import': 0.29; 'version': 0.29; 'optimal': 0.30; 'subject:format': 0.30; "skip:' 10": 0.32; 'cheers': 0.32; 'to:addr:python-list': 0.33; 'question': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'using': 0.35; 'charset:us-ascii': 0.36; 'something': 0.37; 'subject:from': 0.38; 'but': 0.38; 'earlier': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'perhaps': 0.39; 'johnson': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'serving': 0.66; 'p.s.': 0.67 Date: Mon, 20 Jun 2011 11:41:50 -0800 From: Tim Johnson To: python-list@python.org Subject: Re: Parsing a dictionary from a format string References: <20110620181446.GI1971@johnsons-web.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110620181446.GI1971@johnsons-web.com> Organization: AkWebsoft User-Agent: Mutt/1.5.20 (2009-06-14) 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: 22 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308598897 news.xs4all.nl 49046 [::ffff:82.94.164.166]:50639 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8026 * Tim Johnson [110620 10:28]: > Currently using python 2.6, but am serving some systems that have > older versions of python (no earlier than. > Question 1: > With what version of python was str.format() first implemented? > Question 2: > Given the following string: > S = 'Coordinates: {latitude}, {longitude}' > Is there a python library that would provide an optimal way > to parse from S the following > {'latitude':"",'longitude':""} > ? P.S. : One solution would be import re re.findall(r'\{([^}]*)\}', s) ## I think, being a regex dummy.. But perhaps there is something more efficient than re? cheers -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com