SyntaxFix
Write A Post
Hire A Developer
Questions
dups = collections.defaultdict(list) for i, e in enumerate(L): dups[e].append(i) for k, v in sorted(dups.iteritems()): if len(v) >= 2: print '%s: %r' % (k, v)
And extrapolate from there.