Reading registry export files

wittempj@hotmail.com martin.witte at gmail.com
Wed Jun 22 14:59:19 CEST 2005


It works fine for me on NT. I think it has nothing to do with Python
but with the way the file is created - what windows version are you on?
Also note the possibility the '/' - I prefer a noatation like below to
avoid ambiguity.

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
py> f = open(r"d:\test.reg")
py> r = f.read()
py> print r
REGEDIT4

I would do it like this however, then join all lists from various .reg
files:
py> f = open(r'd:\test.reg')
py> r = f.readlines()
py> print r
['REGEDIT4\n', '\n',
'[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Ole]\n', '"Enabl
eDCOM"="Y"\n',
'"DefaultLaunchPermission"=hex:01,00,04,80,64,00,00,00,80,00,00,0
0,00,00,00,00,\\\n', '
14,00,00,00,02,00,50,00,03,00,00,00,00,00,18,00,01,00,00
,00,01,01,00,00,00,\\\n', '
00,00,05,12,00,00,00,00,00,00,00,00,00,18,00,01,00,
00,00,01,01,00,00,00,00,\\\n', '
00,05,04,00,00,00,00,00,00,00,00,00,18,00,01,0
0,00,00,01,02,00,00,00,00,00,\\\n', '
05,20,00,00,00,20,02,00,00,01,05,00,00,00
,00,00,05,15,00,00,00,a0,5f,84,1f,\\\n', '
5e,2e,6b,49,ce,12,03,03,f4,01,00,00,
01,05,00,00,00,00,00,05,15,00,00,00,a0,\\\n', '
5f,84,1f,5e,2e,6b,49,ce,12,03,0
3,f4,01,00,00\n', '\n']
>>>

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Ole]
"EnableDCOM"="Y"
"DefaultLaunchPermission"=hex:01,00,04,80,64,00,00,00,80,00,00,00,00,00,00,00,

14,00,00,00,02,00,50,00,03,00,00,00,00,00,18,00,01,00,00,00,01,01,00,00,00,\

00,00,05,12,00,00,00,00,00,00,00,00,00,18,00,01,00,00,00,01,01,00,00,00,00,\

00,05,04,00,00,00,00,00,00,00,00,00,18,00,01,00,00,00,01,02,00,00,00,00,00,\

05,20,00,00,00,20,02,00,00,01,05,00,00,00,00,00,05,15,00,00,00,a0,5f,84,1f,\

5e,2e,6b,49,ce,12,03,03,f4,01,00,00,01,05,00,00,00,00,00,05,15,00,00,00,a0,\
  5f,84,1f,5e,2e,6b,49,ce,12,03,03,f4,01,00,00




More information about the Python-list mailing list