[Tutor] how to split a stream of chars

Bob Gailer bgailer at alum.rpi.edu
Mon Apr 9 20:43:27 CEST 2007


<emilia12 at mail.bg> wrote
>> i have a long stream of data, represented in hexadecimal
>> form. I need to split it in bytes (by 2 chars each). eg
>> '00010203040506'... -> ['00', '01, '02' ...].
>>     
>> So my question is: is there an inverse function of zip, or
>> an easy way to split this long string in pairs (without
>> indexing in cycle, nor regexpr.)?
>>     
I'm developing a Python version of IBM's CMS Pipelines (see 
http://en.wikipedia.org/wiki/Hartmann_pipeline).

You'd apply it to your problem thus:

import pipeline
result = pipeline.pipe('deblock 2', '00010203040506...')

Does this interest you? (The capabilities of Pipelines is MUCH bigger 
than this example!)
Would you like to be an alpha tester of this tool?

-- 
Bob Gailer
510-978-4454



More information about the Tutor mailing list