[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).

Re: [Tutor] search list with regex

2011-01-31 Thread Wayne Werner
On Mon, Jan 31, 2011 at 7:07 AM, Elwin Estle chrysalis_reb...@yahoo.comwrote: 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

Re: [Tutor] search list with regex

2011-01-31 Thread Elwin Estle
--- On Mon, 1/31/11, Wayne Werner waynejwer...@gmail.com wrote: From: Wayne Werner waynejwer...@gmail.com Subject: Re: [Tutor] search list with regex To: Elwin Estle chrysalis_reb...@yahoo.com Cc: tutor@python.org Date: Monday, January 31, 2011, 10:20 AM On Mon, Jan 31, 2011 at 7:07 AM, Elwin

Re: [Tutor] search list with regex

2011-01-31 Thread Alan Gauld
Elwin Estle chrysalis_reb...@yahoo.com 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

Re: [Tutor] search list with regex

2011-01-31 Thread Elwin Estle
--- On Mon, 1/31/11, Alan Gauld alan.ga...@btinternet.com wrote: From: Alan Gauld alan.ga...@btinternet.com Subject: Re: [Tutor] search list with regex To: tutor@python.org Date: Monday, January 31, 2011, 3:29 PM Elwin Estle chrysalis_reb...@yahoo.com wrote parse various text files

Re: [Tutor] search list with regex

2011-01-31 Thread Steven D'Aprano
Alan Gauld wrote: Elwin Estle chrysalis_reb...@yahoo.com 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...

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