Unix fold command in python

dean diabolik at uku.co.uk
Mon Jun 14 06:52:41 EDT 2004


Hello Group:

Hopefully someone can answer my question. 

I have a unix shell command that I would like to emulate in python.
The command is FOLD. I am scanning a file that contains a stream of
data with a record size of 242 bytes but no record delimiters. There
are multiple fields in each record that can be mapped according to
their position:

example

field1 byte 0-4 
field2 byte 5-8
...
...
...
fieldn byte 238-242


How do I make python read a record in and report the contents of a
particular field (and may be carry out an operations with that field).

Much appreciated

regards
dean



More information about the Python-list mailing list