On Sun, Oct 21, 2012 at 12:58 PM, Vincent Davis <vinc...@vincentdavis.net> wrote: > x = 'apple' > for f in range(len(x)-1): > print(x[f:f+2]) > > @Ian, > Thanks for that I was just looking in to that. I wonder which is faster I > have a large set of strings to process. I'll try some timings if I get a > chance later today.
The solution you came up with is probably faster, but less general -- it will only work on sliceable sequences like strings, not arbitrary iterables. -- http://mail.python.org/mailman/listinfo/python-list