Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: List of integers Date: Mon, 14 Dec 2015 04:56:06 -0500 Lines: 22 Message-ID: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100410 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