Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

read csv and store in dictionary python

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}
Comment

PREVIOUS NEXT
Code Example
Python :: write a python program to find table of a number using while loop 
Python :: exit in python 
Python :: change colors markdown pyhton 
Python :: python how to add turtle in tkinter 
Python :: calculate days between two dates python 
Python :: python closure 
Python :: format number in python 
Python :: make screen shot of specific part of screen python 
Python :: how to add header in csv file in python 
Python :: dictionary with double key python 
Python :: sort dict by value python 3 
Python :: make pickle file python 
Python :: python plot multiple lines in same figure 
Python :: sieve of eratosthenes python 
Python :: use a dictionary to make a column of values 
Python :: how to insert item last in list python 
Python :: how to extract integers from string python 
Python :: check if host is reachable python 
Python :: python unzip a zip 
Python :: django app 
Python :: python ftplib get list of directories 
Python :: python printing variables 
Python :: python for loop array index 
Python :: django error table already exists 
Python :: plt.tick_params 
Python :: does jupyter notebook need internet 
Python :: remove index in pd.read 
Python :: python line_profiler 
Python :: como transformar texto a audio y reproducirlo en pyrthon 
Python :: how to set background image in python tkinter 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =