Parsing a text file for information

Emile van Sebille emile at fenx.com
Sun May 19 00:56:07 EDT 2002


Colin Meeks
> I have a text file that is several magabytes in size and would like to
> strip it of certain information. The information I want is always
> preceeded by
>     GETTEXT=
> and is in itself 18 characters long.  Is there a regular expression I
> could use to simplify the task.
>

Here's a way without re's:

[ ii[:18] for ii in text.split('GETTEXT=')[1:] ]

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list