[George] | 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
It's encoded with utf-16. You need to do something like this: <code> import codecs f = codecs.open ("c:/temp/temp.reg", encoding="utf_16") # .reg files seems to have an initial BOM so need need to specify endianness text = f.read () f.close () print text </code> TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list