Hi Emile and John, Thanks a lot for your insight. There is always a better way, or at least a more pythonic one.
Take care. Victor. On Wed, 2006-02-08 at 22:36 -0800, Emile van Sebille wrote: > "Andre Roberge" <[EMAIL PROTECTED]> wrote in message > > > There's a tongue-in-cheek quote that I really like: > > "Sometimes you have a programming problem and it seems like the best > > solution is to use regular expressions; now you have two problems." > > +1 -- There are some things re is good for, but mainly it's good > motivation to just do it in python... > > > n = 'xb1jyzqnd1eenkokqnhep6vp692qi9tmag3owzqw0sdq3zjf' > > length = len(n) > > o = [] > > for i in range(0, length, 3): > > o.append(n[i:i+3]) > > > > Or as a one-liner... > > o = [ n[ii:ii+3] for ii in range(0,len(n),3) ] > > Emile > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor