[Tutor] search list with regex

Elwin Estle chrysalis_reborn at yahoo.com
Mon Jan 31 21:51:38 CET 2011


--- On Mon, 1/31/11, Alan Gauld <alan.gauld at btinternet.com> wrote:

> From: Alan Gauld <alan.gauld at btinternet.com>
> Subject: Re: [Tutor] search list with regex
> To: tutor at python.org
> Date: Monday, January 31, 2011, 3:29 PM
> 
> "Elwin Estle" <chrysalis_reborn at 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...
> 

Yeah, I should probably give that a try.  It was so abysmally slow to do it that way in Tcl that I didn't even think to try it in python.  However, with the vcards, it is perhaps easier to do it the "big string" way, since each vcard is of varying length, but they all start with "BEGIN:VCARD", and end with "END:VCARD".  I can just load the whole works and have it split into individual vcards using that information for the split.


      


More information about the Tutor mailing list