我有一个教育项目,可以完美地在网络版本的Python上工作,但是一旦我尝试在Pycharm上运行它,就会出现此错误JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
我尝试了所有来自stackoverflow的建议,但这些建议均无效,请提供帮助。我的代码`
import collections
import json
def read_json():
with open('sales_log.json') as f:
sales_json = f.read()
return sales_json
def evaluate_sales_data(read_json):
sales_json = read_json
raw_sales_data = json.loads(sales_json)
sales_statistics = collections.Counter(raw_sales_data)
sorted_sales_stat = sales_statistics.most_common()
return sorted_sales_stat
def main():
for product, quantity in evaluate_sales_data(read_json()):
print(product, quantity)
if __name__ == '__main__':
main()`