Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8026 > unrolled thread
| Started by | Tim Johnson <tim@johnsons-web.com> |
|---|---|
| First post | 2011-06-20 11:41 -0800 |
| Last post | 2011-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.
Re: Parsing a dictionary from a format string Tim Johnson <tim@johnsons-web.com> - 2011-06-20 11:41 -0800
| From | Tim Johnson <tim@johnsons-web.com> |
|---|---|
| Date | 2011-06-20 11:41 -0800 |
| Subject | Re: 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
Back to top | Article view | comp.lang.python
csiph-web