Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8031
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <tim@johnsons-web.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.015 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'python': 0.08; 'received:64.4': 0.09; 'subject:string': 0.09; 'def': 0.12; 'wrote:': 0.14; '2.6,': 0.16; 'btw:': 0.16; 'hans': 0.16; 'res': 0.16; 'str.format()': 0.16; 'sections': 0.16; 'compiled': 0.17; 'header:In-Reply-To:1': 0.21; "haven't": 0.22; 'versions': 0.23; 'function': 0.25; 'tests': 0.26; 'later': 0.26; 'thanks': 0.28; 'checking': 0.29; 'version': 0.29; 'module': 0.30; 'subject:format': 0.30; 'this.': 0.31; 'to:addr:python-list': 0.33; 'familiar': 0.33; 'list': 0.33; 'there': 0.35; 'header:User- Agent:1': 0.35; 'using': 0.35; 'charset:us-ascii': 0.36; 'depend': 0.37; 'think': 0.38; 'subject:from': 0.38; 'run': 0.38; 'but': 0.38; 'earlier': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'johnson': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'your': 0.60; 'matter': 0.63; 'serving': 0.66; 'today,': 0.71 |
| Date | Mon, 20 Jun 2011 12:49:16 -0800 |
| From | Tim Johnson <tim@johnsons-web.com> |
| To | python-list@python.org |
| Subject | Re: Parsing a dictionary from a format string |
| References | <mailman.187.1308593682.1164.python-list@python.org> <4dffa8b9$0$49179$e4fe514c@news.xs4all.nl> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <4dffa8b9$0$49179$e4fe514c@news.xs4all.nl> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.198.1308602942.1164.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308602943 news.xs4all.nl 49175 [::ffff:82.94.164.166]:33538 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8031 |
Show key headers only | View raw
* Hans Mulder <hansmu@xs4all.nl> [110620 12:15]:
> On 20/06/11 20:14:46, Tim Johnson wrote:
> >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?
Duh!
> It might be a matter of taste; it might depend on how familiar
> you are with 're'; it might depend on what you mean by 'optimal'.
As in speed.
## and then there is this - which I haven't tested a lot:
def grabBetween(src,begin,end):
"""Grabs sections of text between `begin' and `end' and returns a list of
0 or more sections of text."""
parts = src.split(begin)
res = []
for part in parts:
L = part.split(end)
if len(L) > 1:
res.append(L[0])
return res
I think later today, I will run some time tests using the `re'
module as well as your function and the one above.
BTW: To be more clear (hopefully) I was checking to see if there was
a compiled method/function to do this.
thanks
--
Tim
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Parsing a dictionary from a format string Tim Johnson <tim@johnsons-web.com> - 2011-06-20 10:14 -0800
Re: Parsing a dictionary from a format string Hans Mulder <hansmu@xs4all.nl> - 2011-06-20 22:08 +0200
Re: Parsing a dictionary from a format string Tim Johnson <tim@johnsons-web.com> - 2011-06-20 12:49 -0800
Re: Parsing a dictionary from a format string Tim Johnson <tim@johnsons-web.com> - 2011-06-20 14:39 -0800
csiph-web