问题
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