Binary Register entries Question

Martin von Loewis loewis at informatik.hu-berlin.de
Sun Mar 10 13:50:32 EST 2002


matthias_j at lycos.com (Matthias Janes) writes:

> I exported a Win NT register to a reg file like this.
> 
> [HKEY_CURRENT_USER\Software\TEST]
> "Password"=hex:b3,e8,85,f6,4d,9c,29,04
> 
> Now I'm not sure how to write binary Hex data with python.
[...]

> values = ...... I do not know how to use this for binary hex data

You need to use a byte string:

values = '\xb3\xe8\x85\xf6\x4d\x9c\x29\x04'

If you want to create the string dynamically, use the chr builtin.

Regards,
Martin



More information about the Python-list mailing list