[Tutor] Python regular expression

Max Noel maxnoel_fr at yahoo.fr
Fri Dec 3 22:43:04 CET 2004


On Dec 3, 2004, at 21:34, Rick Muller wrote:

> The file type you mention is also called an INI file,
> and is used for Windows initialization scripts, among
> other things.
>
> There's a nice recipe on this in the Python Cookbook:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334
>
> This will read your file in as a dictionary. You can
> then do searches through lists of the keys:
>
> mydict = LoadConfig(file.ini)
> for key in mydict.keys():
>     if re.search(key,"_at"): do_something(mydict[key])

	Given the size of the file, I don't think that's a good idea...

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list