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


Groups > comp.lang.python > #80712

Re: How to recover bytes function?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:How': 0.10; "'rb')": 0.16; 'bind': 0.16; 'callable': 0.16; 'file.read()': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'function?': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'bytes': 0.24; 'char': 0.24; 'header:In-Reply-To:1': 0.27; 'file': 0.32; 'skip:_ 10': 0.34; 'received:84': 0.35; 'subject:?': 0.36; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'skip:b 40': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'simple': 0.61; 'first': 0.61; 'email addr:gmail.com': 0.63; 'records': 0.73; 'answer:': 0.84; 'recover': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=ZZGTN6lA c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=aoAcgTy3oA8A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=pGLkceISAAAA:8 a=Rc3-Mzu0fyRQsSxAohwA:9 a=QEXdDO2ut3YA:10 a=jfyD8jh429cA:10 a=0nR45R1EECwA:10 a=eklpZK5AtO4A:10
X-AUTH mrabarnett:2500
Date Thu, 13 Nov 2014 23:12:01 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version 1.0
To python-list@python.org
Subject Re: How to recover bytes function?
References <44f58abf-35a8-4741-8b7c-7eabe99a326d@googlegroups.com>
In-Reply-To <44f58abf-35a8-4741-8b7c-7eabe99a326d@googlegroups.com>
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15793.1415920324.18130.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1415920324 news.xs4all.nl 2899 [2001:888:2000:d::a6]:50032
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80712

Show key headers only | View raw


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


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