len( set( d.values() ) ) == len( d.values() )
Anyway, options:
- pairs = zip(d.values(), d.keys())
- pairs = zip(d.itervalues(), d.iterkeys())
- pairs = [(v, k) for (k, v) in d.iteritems()]
And to create a dictionary, just throw dict() around the zip() or list brackets.
No comments:
Post a Comment