Efficient multi-slicing technique?

python at bdurham.com python at bdurham.com
Sun Jan 25 12:09:57 EST 2009


Is there an efficient way to multi-slice a fixed with string into
individual fields that's logically equivalent to the way one
would slice a delimited string using .split()?
Background: I'm parsing some very large, fixed line-width text
files that have weekly columns of data (52 data columns plus
related data). My current strategy is to loop through a list of
slice()'s to build a list of the specific field values for each
line. This is fine for small files, but seems inefficient. I'm
hoping that there's a built-in (C based) or 3rd party module that
is specifically designed for doing multiple field extractions at
once.
Thank you,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090125/a7d00179/attachment.html>


More information about the Python-list mailing list