Weird list conversion

Laura Creighton lac at openend.se
Sun Dec 13 14:57:34 EST 2015


In a message of Sun, 13 Dec 2015 11:45:19 -0800, high5storage at gmail.com writes:
>Hi all,
>
>      f = open("stairs.bin", "rb") 
>      data = list(f.read(16))
>      print data
>
>returns
>
>['=', '\x04', '\x00', '\x05', '\x00', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00']
>
>The first byte of the file is 0x3D according to my hex editor, so why does Python return '=' and not '\x3D'?
>
>As always, thanks for any help!

0x3d is the ascii code for '='



More information about the Python-list mailing list