Regex Question

Thomas Güttler guettler at
Thu Aug 21 12:17:01 CEST 2003

Istvan Albert wrote:

> Thomas Güttler wrote:
>> Hi!
>> I want to parse a file that looks like this:
>> a0001: basbasdb
>> asbddsb
>> asdbasdb
>> abasbd
>> a0002: fffff
>> ffff
>> ffffff
>> ffff
>> I think there is a better solution than this, don't you?
> It is not clear from what you are saying what are the limitations
> for possible key and values. If the ":" character cannot appear
> in a key or a value you could do something a lot simpler:
> elems = line.split(":")

Thank you for this reply. With re.split() it is the way I like it:

More information about the Python-list mailing list