How to split string in equally long parts
Peter Hansen
peter at engcorp.com
Wed Apr 9 15:59:55 EDT 2003
Heiko Henkelmann wrote:
> Peter Hansen wrote:
> > Heiko Henkelmann wrote:
> > > What is the most efficient way to do this?
> >
> > Define "efficient" ...
>
> to be more precise: The fastest way...
I'd bank on re.findall in this case, but I think you'd have to time
each approach to be sure. Just avoid the lambda cases....
Also note that the re.findall method as given probably does not return
a lone final character as a result, while some of the other approaches
probably do. Presumably, since you didn't specify it, you are
planning to ensure the input always splits evenly.
-Peter
More information about the Python-list
mailing list