import requests
r = requests.get('some url')
data = r.text
{"NumberOfPassedStudents":"21061","TotalAttendedCandidates":"74494","NumberOfEnrolledStudents":"84308"}
The above output I got it looks like a dictionary but it is not a dictionary it is a Unicode . My question is I want to get output in the below mention way
Number of Passed Students : 21061
Total Attended Candidates : 74494
Number of Enrolled Students : 84308
What is the code in python 2.7 to convert those Unicode into my desire above mention output.
You can use the in-built
json()method to convert your HTTP response data to a pythondictwhen you have a content-type ofapplication/json.If you have another content type, you can use the
jsonmodule to convert the return string / unicode into a pythondictThen you can get your desired output by treating your result as a
dict