dict.keys()[0] on Python 3 [duplicate]
dict.keys() is a dictionary view. Just use list() directly on the dictionary instead if you need a list of keys, item 0 will be the first key in the (arbitrary) dictionary order: list(prob)[0] or better still just use: next(iter(dict)) Either method works in both Python 2 and 3 and the next() option is certainly more … Read more