import json csv with open delete_many_one_05_0 8_2019 csv as csv_file

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import json, csv
with open('delete_many_one_05_08_2019.csv', 'r') as csv_file, open('hw_2.csv', 'w') as save_file:
file = csv.DictReader(csv_file)
jason = [x['json'].replace('[', '').replace(']', '').replace('\'', '').replace('""', '"') for x in file]
for x in jason:
device_id = json.loads(x)['device_id']
ding_id = json.loads(x)['ding_id']
save_file.write(f'{device_id},{ding_id}\n')