469,338 Members | 8,595 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

Regex Question


I want to parse a file that looks like this:

a0001: basbasdb
a0002: fffff

a???? should be the key and the following lines should
be the value of a dictionary.

My solution looks like this:

regex=re.compile(r'(?:^|\n)(\w\d\d\d\d):((?:.(?!\n \w\d\d\d\d:))*)',
for match in matches:
print match

I think there is a better solution than this, don't you?


Jul 18 '05 #1
0 1390

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by engwar1 | last post: by
2 posts views Thread by Tim Conner | last post: by
6 posts views Thread by Du Dang | last post: by
17 posts views Thread by clintonG | last post: by
5 posts views Thread by Chris | last post: by
6 posts views Thread by Martin Evans | last post: by
7 posts views Thread by Extremest | last post: by
6 posts views Thread by Phil Barber | last post: by
6 posts views Thread by | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.