I'm trying to convert the file "Ano-2016.json" to csv format, but my program returns the following error: UnicodeDecodeError: 'utf8' codec can not decode byte 0xc7 in position 7: invalid continuation byte.
Can someone please help me? This is my code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import unicodecsv as csv
import json
infile = open("Ano-2016.json", "r")
outfile = open("Ano2016_converted.csv", "w")
writer = csv.writer(outfile)
for row in json.loads(infile.read()):
writer.writerow(row)