simplejson.errors.JSONDecodeError: Expecting value: line column () 提示说是解码错误 可以用下面的方法判断json文件是否为空 import json#读取 with open('tmp.json', 'r') as f: data = f.read() if(not bool(data)): print("json is empty!") 但是在非空情况下会报错!!! import json data ={"
python 读取csv文件报错问题 import csv with open('E:/Selenium2script/DDT模块/test.csv','rb') as f: readers = csv.reader(f) next(readers,None) for line in readers: print(line) 输出:_csv.Error: iterator should return strings, not bytes (did you open the file in tex
path = 'D:/Postgraduate/Python/Machine Learning/小象学院机器学习/08.回归实践/8.Regression代码/8.Regression/8.Advertising.csv' data = pd.read_csv(path) x = data[['TV','Radio','Newspaper']] y = data['Sales'] data 报错了,OSError: Initializing from file failed 报错原因在于文件路径