[Python-3000] Droping find/rfind? (original) (raw)
Steven Bethard steven.bethard at gmail.com
Wed Aug 23 21:07:49 CEST 2006
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steven Bethard wrote:
Could you post a simple example or two?
Josiah Carlson wrote:
index = text.find(...) if index >= 0: ... [snip] index = 0 while 1: index = text.find(..., index) if index == -1: break ...
Thanks. So with your search() function, these would be something like:
indices = text.search(pattern, count=1)
if indices:
index, = indices
...and
for index in text.search(pattern):
...if I understood the proposal right.
Steve
I'm not in-sane. Indeed, I am so far out of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy
- Previous message: [Python-3000] Droping find/rfind?
- Next message: [Python-3000] Droping find/rfind?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]