retrieve key of only element in a dictionary (Python 3)

Steven D'Aprano steve at pearwood.info
Sat Mar 19 04:29:15 EDT 2016


On Sat, 19 Mar 2016 12:36 pm, Chris Angelico wrote:

> So unpacking will give you those keys - in an arbitrary order. Of
> course, you don't care about the order when there's only one.

But what if you want the key in reverse order?

# Standard order
[key] = mydict

# Reverse order
[yɘʞ] = mydict





-- 
Steven




More information about the Python-list mailing list