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


Groups > comp.lang.python > #100410

Re: List of integers

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: List of integers
Date Mon, 14 Dec 2015 04:56:06 -0500
Lines 22
Message-ID <mailman.5.1450086999.14916.python-list@python.org> (permalink)
References <6faae197-594a-4447-b146-6f5e01185e26@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de 9MwTgi+MHfgQsrJC5G7UjQnhpm62PUCKTumtwarJ17NQ==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'binary': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'jan': 0.11; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'strings,': 0.29; 'yields': 0.29; 'print': 0.30; 'subject:List': 0.33; 'file': 0.34; 'text': 0.35; 'received:71': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'data': 0.39; 'to:addr:python.org': 0.40; 'receive': 0.71; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host pool-71-185-227-36.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
In-Reply-To <6faae197-594a-4447-b146-6f5e01185e26@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:100410

Show key headers only | View raw


On 12/13/2015 7:24 PM, KP wrote:
>
>
> data = list(f.read(4))
> print data
>
> from a binary file might give

In 2.x, a binary file and a text file are not distinguished.

> ['\x10', '\x20', '\x12', '\x01']

If a 'binary' file yields strings, you must be using 2.x.

> How can I receive this instead?
> [0x10, 0x20, 0x12, 0x01]

Use python 3.

-- 
Terry Jan Reedy

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


Thread

List of integers KP <kai.peters@gmail.com> - 2015-12-13 16:24 -0800
  Re: List of integers Chris Angelico <rosuav@gmail.com> - 2015-12-14 11:32 +1100
    Re: List of integers KP <kai.peters@gmail.com> - 2015-12-13 19:11 -0800
  Re: List of integers Terry Reedy <tjreedy@udel.edu> - 2015-12-14 04:56 -0500
    Re: List of integers Steven D'Aprano <steve@pearwood.info> - 2015-12-14 21:37 +1100

csiph-web