Kaydet (Commit) 42f4cfa9 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Add new example

üst c77f6c6e
......@@ -539,5 +539,8 @@ def grouper(n, iterable, padvalue=None):
"grouper(3, 'abcdefg', 'x') --> ('a','b','c'), ('d','e','f'), ('g','x','x')"
return izip(*[chain(iterable, repeat(padvalue, n-1))]*n)
def reverse_map(d):
"Return a new dict with swapped keys and values"
return dict(izip(d.itervalues(), d))
\end{verbatim}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment