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


Groups > comp.lang.python > #98659

Re: using binary in python

From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.python
Subject Re: using binary in python
Date 2015-11-11 22:32 +0100
Organization A noiseless patient Spider
Message-ID <n20c0p$c0o$1@dont-email.me> (permalink)
References <mailman.164.1447060794.16136.python-list@python.org> <HbGdndTOtKc3EdzLnZ2dnUU7-YnOydjZ@giganews.com> <mailman.218.1447190949.16136.python-list@python.org>

Show all headers | View raw


Am 10.11.15 um 22:29 schrieb kent nyberg:
> On Mon, Nov 09, 2015 at 10:20:25PM -0800, Larry Hudson via Python-list wrote:
>> Your questions are somewhat difficult to answer because you misunderstand
>> binary.  The key is that EVERYTHING in a computer is binary.  There are NO
>> EXCEPTIONS, it's all binary ALL the time.  The difference comes about in how
>> this binary data is displayed and manipulated.  I want to emphasize, ALL the
>> DATA is binary.
>>
>
> Thanks alot for taking the time.
> I get it now. I sort of, but not fully, misunderstood the conecpt of binary files.
> The thing I was after; and the thing Im playing with now after a more succesfull time with google,
> is writing more specific things to a file than just strings.
> English is not my native language so please forgive me, but
> I wanted to write specifc 16bit codes, and read them. And later play with bitwise operations on them. Sort of.
> It might not make sense at all, but hey..  it doesnt have to

I think I understand what you want. Look at the struct module:

https://docs.python.org/2/library/struct.html

You can write/read binary data from files with standard means. Using 
struct, you can interpret or format integer values into a specific 
binary format. That would allow to create a reader or writer for a given 
binary format in Python.

	Christian

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


Thread

using binary in python kent nyberg <kent@z-sverige.nu> - 2015-11-08 16:27 -0500
  Re: using binary in python Jussi Piitulainen <harvesting@makes.email.invalid> - 2015-11-09 11:58 +0200
  Re: using binary in python Larry Hudson <orgnut@yahoo.com> - 2015-11-09 22:20 -0800
    Re: using binary in python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-10 15:14 -0500
      Re: using binary in python mm0fmf <none@mailinator.com> - 2015-11-10 20:36 +0000
        Re: using binary in python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-11-10 16:02 -0500
          OT: Re: using binary in python mm0fmf <none@mailinator.com> - 2015-11-10 22:17 +0000
        Re: using binary in python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-10 21:22 +0000
        Re: using binary in python Random832 <random832@fastmail.com> - 2015-11-10 19:03 -0500
        Re: using binary in python Random832 <random832@fastmail.com> - 2015-11-10 19:04 -0500
      Re: using binary in python Larry Hudson <orgnut@yahoo.com> - 2015-11-10 19:53 -0800
    Re: using binary in python Random832 <random832@fastmail.com> - 2015-11-10 15:44 -0500
    Re: using binary in python kent nyberg <kent@z-sverige.nu> - 2015-11-10 16:29 -0500
      Re: using binary in python Christian Gollwitzer <auriocus@gmx.de> - 2015-11-11 22:32 +0100
    Re: using binary in python Michael Torrie <torriem@gmail.com> - 2015-11-10 17:19 -0700

csiph-web