Answer the question
In order to leave comments, you need to log in
How to pull value from PYTHON3 dictionary?
Python3
There are JSON responses from requests.post like this:
new: {
hid: '10101'
}
success: {
hid: '10102'
}
*hid value always changes, and sometimes new and success also change between each other
how do I get the value hid despite the name of the parent, if you can call it that)
Answer the question
In order to leave comments, you need to log in
list(response.values())[0]['hid'] did it like this, it seems to work!
if "new" in data:
data["new"]["hid"]
elif "success" in data:
data["success"]["hid"]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question