chunking a long string?
nick.cash at npcinternational.com
Fri Nov 8 18:59:33 CET 2013
> I have a long string (several Mbytes). I want to iterate over it in manageable chunks
This is a weirdly common question. See http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python for several solutions.
It's been proposed to be added to itertools before, but rejected: https://mail.python.org/pipermail/python-ideas/2012-July/015671.html and http://bugs.python.org/issue13095
- Nick Cash
More information about the Python-list