On Thu, 2006-02-09 at 09:45 +0000, Alan Gauld wrote: > > Define easier :-) > Right!
> You could just use string slicing and a stepsize of 3 in range: > > lst = [mystring[index : index+3] for index in range(0,len(mystring),3)] > Ever since I found them, list comprehensions are my favorites. > ... and you still have problems where the > string is not exactly divisible by 3, should you add padding? > Alan, I understand where you are coming from. However, in this case I don't have a problem since the incoming string will always be divisible by 3, in this particular case. Thanks for pointing it out though. Victor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor