Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100387

Weird list conversion

Newsgroups comp.lang.python
Date 2015-12-13 11:45 -0800
Message-ID <5926ced0-5b86-41f2-81e8-55cc6f71b78c@googlegroups.com> (permalink)
Subject Weird list conversion
From high5storage@gmail.com

Show all headers | View raw


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!

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Weird list conversion high5storage@gmail.com - 2015-12-13 11:45 -0800
  Re: Weird list conversion Laura Creighton <lac@openend.se> - 2015-12-13 20:57 +0100
    Re: Weird list conversion KP <kai.peters@gmail.com> - 2015-12-13 12:05 -0800
      Re: Weird list conversion Erik <python@lucidity.plus.com> - 2015-12-13 20:28 +0000
      Re: Weird list conversion Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-13 13:28 -0700
      Re: Weird list conversion Erik <python@lucidity.plus.com> - 2015-12-13 20:31 +0000
      Re: Weird list conversion Larry Hudson <orgnut@yahoo.com> - 2015-12-13 12:42 -0800
      Re: Weird list conversion Chris Angelico <rosuav@gmail.com> - 2015-12-14 08:09 +1100
  Re: Weird list conversion Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-13 12:59 -0700

csiph-web