Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80712
| Date | 2014-11-13 23:12 +0000 |
|---|---|
| From | MRAB <python@mrabarnett.plus.com> |
| Subject | Re: How to recover bytes function? |
| References | <44f58abf-35a8-4741-8b7c-7eabe99a326d@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15793.1415920324.18130.python-list@python.org> (permalink) |
On 2014-11-13 22:32, satishmlmlml@gmail.com wrote:
> file = open('data.bin', 'rb')
> bytes = file.read()
> bytes
> b'\x00\x00\x00\x02spam\x00\x03?\x9d\xf3\xb6'
> records = [bytes([char] * 8) for char in b'spam']
> TypeError: 'bytes' object is not callable
>
> How to recover bytes function?
>
The simple answer:
bytes = __builtins__.bytes
The smart answer:
Don't bind to 'bytes' in the first place!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to recover bytes function? satishmlmlml@gmail.com - 2014-11-13 14:32 -0800 Re: How to recover bytes function? MRAB <python@mrabarnett.plus.com> - 2014-11-13 23:12 +0000 Re: How to recover bytes function? Chris Angelico <rosuav@gmail.com> - 2014-11-14 10:14 +1100 Re: How to recover bytes function? sohcahtoa82@gmail.com - 2014-11-13 15:16 -0800 Re: How to recover bytes function? Ben Finney <ben+python@benfinney.id.au> - 2014-11-14 10:37 +1100 Re: How to recover bytes function? Cameron Simpson <cs@zip.com.au> - 2014-11-14 18:46 +1100
csiph-web