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


Groups > comp.lang.python > #80747

Re: How to recover bytes function?

Date 2014-11-14 18:46 +1100
From Cameron Simpson <cs@zip.com.au>
Subject Re: How to recover bytes function?
References <44f58abf-35a8-4741-8b7c-7eabe99a326d@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.15814.1415951174.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 13Nov2014 14:32, satishmlmlml@gmail.com <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 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 <cs@zip.com.au>

Madness takes its toll.  Please have exact change.
        - Janice Hanes <janice@anv.net>

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


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