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


Groups > comp.lang.python > #8026 > unrolled thread

Re: Parsing a dictionary from a format string

Started byTim Johnson <tim@johnsons-web.com>
First post2011-06-20 11:41 -0800
Last post2011-06-20 11:41 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Parsing a dictionary from a format string Tim Johnson <tim@johnsons-web.com> - 2011-06-20 11:41 -0800

#8026 — Re: Parsing a dictionary from a format string

FromTim Johnson <tim@johnsons-web.com>
Date2011-06-20 11:41 -0800
SubjectRe: Parsing a dictionary from a format string
Message-ID<mailman.190.1308598897.1164.python-list@python.org>
* Tim Johnson <tim@johnsons-web.com> [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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web