[Python3]正确重新格式化JSON

时间:2016-09-27 20:10:03

标签: python json web-scraping

我正在使用Requests和BS4抓取一个网站,我提取了以下JSON(如果你可以称之为)。问题是它的格式不正确:

with open(data_file) as data:
    next(data) #Are you sure you want this?  It essentially throws away the first line
               # of the data file
    for line in data:
        line = line.strip()
        line = line.split()
        output.write(line)
logging.info("Successfully added lines")

我有什么方法可以将JSON格式化为JSON标准吗?

0 个答案:

没有答案