2016-04-22 6 views
-2

私が使用している開梱PythonのURLリクエスト

{"probability": {"neg": 0.30135019761690551, "neutral": 0.27119050546800266, "pos": 0.69864980238309449}, "label": "pos"} 

をし、私が閲覧したいというテキストの文字列としてだけではなく、構造体を用いました。どうすれば辞書に変換できますか?

+0

'json.loads()'? – Delgan

+3

http://stackoverflow.com/questions/4917006/string-to-dictionary-in-python – Firedrake969

答えて

1

はJSONレスポンスコンテンツをロードし、あなたにPythonのデータ構造を返しますjson() methodを使用します。

response = requests.post('http://text-processing.com/api/sentiment/', data=data) 
print(response.json()) 
関連する問題