【发布时间】:2020-04-01 17:18:53
【问题描述】:
我在使用 python 的 json 模块读取 JSON 文件时遇到错误,我无法理解出了什么问题。以下是我的文件和代码供您参考:
json.load(files_lst[1])
错误:
AttributeError: 'str' 对象没有属性 'read'
在阅读了几个答案后,我也尝试了:
json.loads(files_lst[1])
但我收到以下错误:
JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
这里有什么问题?非常感谢您的帮助
>>> files_lst
['All_Transcripts/x3021_10.50.48.111_04-04-2019.json',
'All_Transcripts/x5363_09.33.36.955_08-27-2019.mp3.json',
'All_Transcripts/x3580_11.35.53.462_05-13-2019.json',
'All_Transcripts/x4342_08.55.01.523_08-01-2019.json',
'All_Transcripts/x9496_15.26.32.382_05-21-2019.json',
'All_Transcripts/x5374_08.38.15.692_06-17-2019.json',
'All_Transcripts/x4342_13.43.57.128_03-21-2019.json']
【问题讨论】:
标签: json python-3.x