import csv
import json
file_path = "your_filePath.csv"
csvfile = open(file_path, 'r')
jsonfile = open('file.json', 'w')
fieldnames = ("Starting Station Latitude", "Starting Station Longitude", "Ending Station Latitude", "Ending Station Longitude")
reader = csv.DictReader( csvfile, fieldnames)
out = json.dumps( [ row for row in reader ] )
jsonfile.write(out)
python实现csv转json格式
猜你喜欢
转载自blog.csdn.net/Luenci379/article/details/84188659
今日推荐
周排行