【问题标题】:Python json.loads shows ValueError: Expecting , delimiter: line 1Python json.loads 显示 ValueError: Expecting , delimiter: line 1
【发布时间】:2017-04-18 17:56:06
【问题描述】:

我正在尝试读取推文的 json 文件,但我不断收到此错误

ValueError: Expecting , delimiter: line 1 column 537 (char 536)

Code:
import json
import pandas as pd
import matplotlib.pyplot as plt

import json

with open('/Users/Mustafa/desktop/tweets.json', 'r') as f:
    line = f.readline() # read only the first tweet/line
    tweet = json.loads(line) # load it as Python dict
    print(json.dumps(tweet, indent=4)) # pretty-print

知道如何解决这个问题或我做错了什么吗?

【问题讨论】:

    标签: json delimiter


    【解决方案1】:

    没有分隔符的错误 json 文件不是 json!把分隔符放到文件里!!!

    崇高的文字会告诉你行和行 cntr+p :linenumber:columnumber

    【讨论】:

      猜你喜欢
      • 2021-11-29
      • 2014-01-30
      • 2012-03-06
      • 2020-03-30
      • 2021-06-11
      • 1970-01-01
      • 2020-09-05
      相关资源
      最近更新 更多