Xavier Morel <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > did you read the string chapter in the tutorial ? > > > > http://docs.python.org/tut/node5.html#SECTION005120000000000000000 > > > > around the middle of that chapter, there's a section on slicing: > > > > "substrings can be specified with the slice notation: two indices > > separated by a colon" > > > Fredrik, how would you use slices to split a string by groups of 3 > characters?
I can't answer for him, but maybe: [s[i:i+3] for i in xrange(0, len(s), 3)] ...? Alex -- http://mail.python.org/mailman/listinfo/python-list