| Store | Cart

Re: How to recover bytes function?

From: Cameron Simpson <c...@zip.com.au>
Fri, 14 Nov 2014 18:46:09 +1100
On 13Nov2014 14:32, sati...@gmail.com <sati...@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 best way is not to use "bytes" for something else when you know you will be 
using the builtin version as well. Using the same name for two things is 
generally a bad idea.

The second, and worse, way is to see the documentation for the "builtins" 
module.

Cheers,
Cameron Simpson <c...@zip.com.au>

Madness takes its toll.  Please have exact change.
        - Janice Hanes <jan...@anv.net>
-- 
https://mail.python.org/mailman/listinfo/python-list

Recent Messages in this Thread
sati...@gmail.com Nov 13, 2014 10:32 pm
MRAB Nov 13, 2014 11:12 pm
Chris Angelico Nov 13, 2014 11:14 pm
sohc...@gmail.com Nov 13, 2014 11:16 pm
Ben Finney Nov 13, 2014 11:37 pm
Cameron Simpson Nov 14, 2014 07:46 am
Messages in this thread