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


Groups > comp.lang.python > #62108

[newbie] Saving binaries in a specific way

Newsgroups comp.lang.python
Date 2013-12-16 14:19 -0800
Message-ID <3dcea919-82ad-4e0a-a00a-fa04ba39b1dd@googlegroups.com> (permalink)
Subject [newbie] Saving binaries in a specific way
From Djoser <pedrovg000@gmail.com>

Show all headers | View raw


Hi all,

I am new to this forum and also to Python, but I'm trying hard to understand it  better.
I need to create a binary file, but the first 4 lines must be in signed-Integer16 and all the others in signed-Integer32. I have a program that does that with Matlab and other with Mathematica, but I'm converting all for Python.

I tried first to convert the number to binary using 'bin(number'), than I removed the '0b' and converted to 'Int16' or 'Int32', but with this approach I can't save a binary file using 'bytearray(').

How can I do that?


Thanks in advance.

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


Thread

[newbie] Saving binaries in a specific way Djoser <pedrovg000@gmail.com> - 2013-12-16 14:19 -0800
  Re: [newbie] Saving binaries in a specific way Chris Kaynor <ckaynor@zindagigames.com> - 2013-12-16 14:28 -0800
    Re: [newbie] Saving binaries in a specific way Djoser <pedrovg000@gmail.com> - 2013-12-16 14:35 -0800
  Re: [newbie] Saving binaries in a specific way Tim Chase <python.list@tim.thechases.com> - 2013-12-16 16:48 -0600
    Re: [newbie] Saving binaries in a specific way Djoser <pedrovg000@gmail.com> - 2013-12-16 15:30 -0800
      Re: [newbie] Saving binaries in a specific way rusi <rustompmody@gmail.com> - 2013-12-16 17:01 -0800
  Re: [newbie] Saving binaries in a specific way Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-12-17 11:21 +0000
    Re: [newbie] Saving binaries in a specific way Djoser <pedrovg000@gmail.com> - 2013-12-17 10:54 -0800

csiph-web