ANN: winreg module (_winreg wrapper)

Ollie Rutherfurd oliver at
Tue Jul 24 18:17:00 CEST 2001


I've written an object-oriented wrapper for _winreg.  It's a little higher
level than _winreg, and it allows you to access the sub keys and values of a
key, via a key object.

I remember seeing a similar post a while back, but as I couldn't find the post
or the module...  Anyway, I'm learning Python, and this seemed like a good
little project.

Here's a little code snippet showing how it can be used:

>>> from winreg import *
>>> key = Key(HKCR)
>>> len(key.keys)
>>> print key[0].name
>>> '.py' in key.keys
>>> print key['.py'].values[None]
>>> pyfile = key['Python.File']
>>> print pyfile['Shell\\Open\\Command'].values[None]
"C:\\Python21\\python.exe" %1" %*

There's not really any external documentation, but I used DocTest (which is
really cool!), so there are a bunch of usage examples in the code.

You can find winreg here:

If you check it out, I'd love feedback!

-Ollie Rutherfurd
oliver at

More information about the Python-list mailing list