numpy.frombuffer != unpack() ??

Robert Kern robert.kern at gmail.com
Fri May 16 19:50:38 EDT 2008


Marlin Rowley wrote:
> All:
>  
> Say I have an array:
>  
> a = (['rrrrggggbbbbaaaa'],['rrrrggggbbbbaaaa'])

I'm sorry, you are going to have to be less elliptical. Exactly what do you have 
there? It's certainly not an array, but a tuple of single-element lists each 
containing a single string which can be interpreted as a group of 4 IEEE-754 
single-precision floats. Is this correct? Do you really have single-element 
lists? Some more context would be nice (can the tuple be longer? can the lists 
be longer? can the strings be longer? etc.).

But basically, I would concatenate all of the strings together in the correct 
order and use numpy.fromstring() on the resulting string.

And please, just respond to the list. I read this through GMane, and I don't 
like getting duplicates in my in-box.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list