Re: [Tutor] search list with regex

2011-01-31 Thread Steven D'Aprano
Elwin Estle wrote: Tcl's list search command has the option to search for a list element that matches a given regex. Is there something similar in python? Not using regexes. If not, it seems like it should be fairly trivial for me to write my own (just wondering if I would be re-inventing t

Re: [Tutor] search list with regex

2011-01-31 Thread Steven D'Aprano
Alan Gauld wrote: "Elwin Estle" wrote parse various text files and my standard method is to slurp the whole thing up into a string variable, then break it up into a list that I can then work on If you read it with readlines() Python will do all of that for you... Very true, and it's a go

Re: [Tutor] search list with regex

2011-01-31 Thread Elwin Estle
--- On Mon, 1/31/11, Alan Gauld wrote: > From: Alan Gauld > Subject: Re: [Tutor] search list with regex > To: tutor@python.org > Date: Monday, January 31, 2011, 3:29 PM > > "Elwin Estle" > wrote > > > parse various text files and my standard method i

Re: [Tutor] search list with regex

2011-01-31 Thread Alan Gauld
"Elwin Estle" wrote parse various text files and my standard method is to slurp the whole thing up into a string variable, then break it up into a list that I can then work on If you read it with readlines() Python will do all of that for you... HTH, -- Alan Gauld Author of the Learn to P

Re: [Tutor] search list with regex

2011-01-31 Thread Elwin Estle
--- On Mon, 1/31/11, Wayne Werner wrote: From: Wayne Werner Subject: Re: [Tutor] search list with regex To: "Elwin Estle" Cc: tutor@python.org Date: Monday, January 31, 2011, 10:20 AM On Mon, Jan 31, 2011 at 7:07 AM, Elwin Estle wrote: Tcl's list search command has the o

Re: [Tutor] search list with regex

2011-01-31 Thread Wayne Werner
On Mon, Jan 31, 2011 at 7:07 AM, Elwin Estle wrote: > Tcl's list search command has the option to search for a list element that > matches a given regex. Is there something similar in python? If not, it > seems like it should be fairly trivial for me to write my own (just > wondering if I would

[Tutor] search list with regex

2011-01-31 Thread Elwin Estle
Tcl's list search command has the option to search for a list element that matches a given regex.  Is there something similar in python?  If not, it seems like it should be fairly trivial for me to write my own (just wondering if I would be re-inventing the wheel).