import csv with open('coors.csv', mode='r') as infile: reader = csv.reader(infile) with open('coors_new.csv', mode='w') as outfile: writer = csv.writer(outfile) mydict = {rows[0]:rows[1] for rows in reader}
Here is what the above code is Doing:
1. Open the input file in read mode.
2. Create a reader object.
3. Open the output file in write mode.
4. Create a writer object.
5. Create a dictionary from the reader object.