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


Groups > comp.lang.python > #100389

Re: Weird list conversion

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: Weird list conversion
Date Sun, 13 Dec 2015 12:59:25 -0700
Lines 17
Message-ID <mailman.217.1450036812.12405.python-list@python.org> (permalink)
References <5926ced0-5b86-41f2-81e8-55cc6f71b78c@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de jUcbZDlGzwtVh8L9UXceHAJjo0Gh7yAy35c2niZJ2Rqg==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'python': 0.10; 'editor,': 0.16; 'hex': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'all,': 0.20; '2015': 0.20; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'subject:list': 0.26; 'equivalent': 0.27; 'message-id:@mail.gmail.com': 0.27; '13,': 0.29; 'print': 0.30; 'file': 0.34; 'received:google.com': 0.35; 'according': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'why': 0.39; 'data': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; "they're": 0.66; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=uXdGSDEmijGu2XouUE1yv+q5J5X6qr0GGYupzrAb6zQ=; b=kX9/Qy3qQWxxM9MZ4PWDIuLCn3/AQUJmpC5dR5vYDzAil669WgiQuobxpeTWsuiRJr zKRQe9evz+1BYnKSsXRynAvoEIcYa+rXojtLJECR5mswnYsyOOUKz6OIV0Kx+WhveCjG pWh66LO7UoAnwWrgV7cVvBoW9X5pZvK4t3Q/B0VVvmSTbSwZIrqYPCFvm2FN7KOevVLj gU+GHZfUBjDEc5RsMTwGWvXXaMqBdcyWdwmLe9tScLCP6sOLVk7v9SgwLEQtkeZMdHhu tPEUA3T8Gnc+hOdZ/Yv8mXrYyzUSVAsRy6I1MeF4g9asGy29+RUyGQDBajAhV5pZu0kl qiPQ==
X-Received by 10.50.138.136 with SMTP id qq8mr12005897igb.68.1450036804649; Sun, 13 Dec 2015 12:00:04 -0800 (PST)
In-Reply-To <5926ced0-5b86-41f2-81e8-55cc6f71b78c@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Xref csiph.com comp.lang.python:100389

Show key headers only | View raw


On Sun, Dec 13, 2015 at 12:45 PM,  <high5storage@gmail.com> wrote:
> Hi all,
>
>       f = open("stairs.bin", "rb")
>       data = list(f.read(16))
>       print data
>
> returns
>
> ['=', '\x04', '\x00', '\x05', '\x00', '\x01', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00']
>
> The first byte of the file is 0x3D according to my hex editor, so why does Python return '=' and not '\x3D'?

They're equivalent representations of the same thing.

py> '\x3D'
'='

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


Thread

Weird list conversion high5storage@gmail.com - 2015-12-13 11:45 -0800
  Re: Weird list conversion Laura Creighton <lac@openend.se> - 2015-12-13 20:57 +0100
    Re: Weird list conversion KP <kai.peters@gmail.com> - 2015-12-13 12:05 -0800
      Re: Weird list conversion Erik <python@lucidity.plus.com> - 2015-12-13 20:28 +0000
      Re: Weird list conversion Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-13 13:28 -0700
      Re: Weird list conversion Erik <python@lucidity.plus.com> - 2015-12-13 20:31 +0000
      Re: Weird list conversion Larry Hudson <orgnut@yahoo.com> - 2015-12-13 12:42 -0800
      Re: Weird list conversion Chris Angelico <rosuav@gmail.com> - 2015-12-14 08:09 +1100
  Re: Weird list conversion Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-13 12:59 -0700

csiph-web