Splitting a string into groups of three characters
Terry Reedy
tjreedy at udel.edu
Mon Aug 8 00:02:52 EDT 2005
<lemon97 at gmail.com> wrote in message
news:1123466304.304964.211380 at g49g2000cwa.googlegroups.com...
> Is there a function that split a string into groups, containing an "x"
> amount of characters?
There have been previous threads giving various solutions (which generally
are not specific to strings). You might find some some by searching the
Google archive of this group. Some of the variations depend on what to do
if len(s) % x != 0. Do you pad to x, drop the extras, or return a
deficient group?
Terry J. Reedy
More information about the Python-list
mailing list