Python读取JSON文件的小错误

时间:2025-03-17 22:06:14
  • : Extra data: line 2 column 1 (char 59)

  这是因为JSON文件太大而读取错误,解决方法是按字符串的形式一行一行的读取。

file = open("", 'r', encoding='utf-8')
content = []
for line in ():
    dict = (line)
    (dict)
  • : Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

   这是因为JSON文件中使用的是单引号,改为双引号即可。

相关文章