New folder structure
This commit is contained in:
19
Tools/csv_to_json.py
Executable file
19
Tools/csv_to_json.py
Executable file
@@ -0,0 +1,19 @@
|
||||
import csv
|
||||
import json
|
||||
|
||||
def make_json(csvFilePath, jsonFilePath):
|
||||
data = {}
|
||||
with open(csvFilePath, encoding='UTF-8') as csvf:
|
||||
csvReader = csv.DictReader(csvf)
|
||||
|
||||
for rows in csvReader:
|
||||
key = rows['id']
|
||||
data[key] = rows
|
||||
|
||||
with open(jsonFilePath, 'w', encoding='UTF-8') as jsonf:
|
||||
jsonf.write(json.dumps(data, indent=4))
|
||||
|
||||
csvFilePath = r'zona_rec_filtrado.csv'
|
||||
jsonFilePath = r'zona_rec.json'
|
||||
|
||||
make_json(csvFilePath, jsonFilePath)
|
||||
Reference in New Issue
Block a user