- 
                How would I set the dict[value] to correspond to its dict[key] where the value itself is a dictionary?over 9 years ago 
- 
          
          over 9 years ago Hi Paola Santiago, use this concept you have to connect with row. reader = csv.DictReader(open('C:\\Users\\Shiva\\Desktop\\demo.csv')) result = {} for row in reader: for column, value in row.items(): result.setdefault(column, []).append(value) print('Column -> ', column, '\nValue -> ', value) print(result) fieldnames = result.keys() csvwriter = csv.DictWriter(open('C:\\Users\\Shiva\\Desktop\\Demo_out.csv', 'w'), delimiter=',', fieldnames=result.keys()) csvwriter.writerow(dict((fn,fn) for fn in fieldnames)) for row in result.items(): print('Values -> ', row)
- 
          

 
               
               

1 Answer(s)