How to recover bytes function?
sohcahtoa82 at gmail.com
sohcahtoa82 at gmail.com
Thu Nov 13 18:16:20 EST 2014
On Thursday, November 13, 2014 2:32:47 PM UTC-8, satish... at 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?
So how many times do we have to ask you to tell us your EXPECTED output before you start actually doing that?
'bytes' is a built-in function, but built-in function definitions can be overwritten by redeclaring them. In this case, you're deleting the bytes function by assigning some read data to `bytes`. Don't do that. Either use a variable name other than 'bytes', or recover your bytes function.
-DJ
More information about the Python-list
mailing list