Answer the question
In order to leave comments, you need to log in
How to find the index in the dictionary, having a float value?
Let there obj = {"abc": "37.6215879462381080"}
be Is it possible to find somehow by the value "37.6215879462381080" that it belongs to "abc"?
PS Happy New Year everyone! =)
Answer the question
In order to leave comments, you need to log in
you can and do not need to bypass anything - and it doesn’t matter if it is a string or something else. The main thing is that the key should be an immutable object.
For example, if you have two objects in the dictionary (or more - it doesn't matter), then the desired one is searched like this:
obj = {"abc" : "37.6215879462381080", "def" : "234.456"}
for (k, v) in obj.items ():
if k== 'abc': # or if v == "37.6215879462381080": print(k) if necessary
print(v)
response 37.6215879462381080
watch for indentation - they are not shown here.
Happy new year friends!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question