Reading registry export files

George gtog at _no___spam_myrealbox.com
Wed Jun 22 04:34:29 EDT 2005


Hi,

I have exported some registry-keys using Regedit to a number of 
.reg-files. I can open these files using any text editor. Now I wanted 
to write a simple Python script to concatenate all these files to one 
output file. (Please note that I'm a newbie).

However, if I do something like:

 >>> f=open('c:/documents and settings/myname/desktop/test.reg','r')
 >>> r=f.read()
 >>> print r

I get a lot of garbage with a lot characters which the Python shell 
cannot display (it display a square instead). The above code does work 
with ordinary text files.

Should I open these reg-files in a different way, or treat them 
differently once read in Python?

Thanks for any help.

Kind regards, George



More information about the Python-list mailing list