n00m <n...@narod.ru> writes: > On Nov 27, 1:22 pm, Jon Clements <jon...@googlemail.com> wrote: >> Of course, if you take '~' literally (len(s) <= -10001) I reckon >> you've got way too many :) >> >> Jon. > > Then better: len(s) < abs(~10000) > > PS It's a hard problem; so let's leave it alone
what's hard? substrings of a string? If you don't care too much about efficiency it's easy enough: import itertools def subs(s): return set(itertools.chain( s[i:j] for i in xrange(len(s)) for j in xrange(i, len(s)+1))) -- http://mail.python.org/mailman/listinfo/python-list