Python json.loads shows ValueError: Expecting , delimiter: line 1

邮差的信 提交于 2019-12-12 01:50:57

问题


I'm trying to read a json file of tweets but i keep getting this error

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

any idea how I can fix this or what im doing wrong?


回答1:


BAD json file without delimiter in it it`s not json! put the delimiter in file!!!

sublime text will show you line and row cntr+p :linenumber:columnumber



来源:https://stackoverflow.com/questions/43479126/python-json-loads-shows-valueerror-expecting-delimiter-line-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!