【发布时间】:2018-03-22 08:11:20
【问题描述】:
我得到了google json api的响应,并将文件保存在一个json文件中,如下所示
JSON 文件drive.google.com/open?id=1Esuv9KpikqhwccL-dGm-IFfI5S6V7plV
我想在python 2中解析它。我试过了
for result in response.results:
# The first alternative is the most likely one for this portion.
print('Transcript: {}'.format(result.alternatives[0].transcript))
print('Confidence: {}'.format(result.alternatives[0].confidence))
但它会引发错误
'str' object has no attribute 'results'
后来我试过了
jsondata = json.load(json_file_path)
但它说
'str' object has no attribute 'read'
有什么帮助吗?
【问题讨论】: