how to split a string (or sequence) into pairs of characters?
bhoel at web.de
Thu Aug 15 22:31:27 CEST 2002
Andrew Koenig <ark at research.att.com> writes:
> Jason> Can anyone come up with a better way of performing these
> Jason> operations? Extra kudos if it easily extends to any sublength
> Jason> and not just pairs.
> >>> import re
> >>> re.findall('..', 'aabbccddee')
> ['ab', 'cd', 'ef']
>>> re.findall('..', 'aabbccddee')
['aa', 'bb', 'cc', 'dd', 'ee']
bhoel at web.de / http://starship.python.net/crew/bhoel/
It is unlawful to use this email address for unsolicited ads
(USC Title 47 Sec.227). I will assess a US$500 charge for
reviewing and deleting each unsolicited ad.
More information about the Python-list