Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Weird list conversion Date: Sun, 13 Dec 2015 12:59:25 -0700 Lines: 17 Message-ID: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100389 On Sun, Dec 13, 2015 at 12:45 PM, 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' '='