[Tutor] Read a file, Load a dictionary

Glenn Lester glester at avant.ca
Fri Jul 25 00:50:30 CEST 2014


I have been looking around for a way to read a comma delimited csv file and
then load it into a dictionary. So far any of my usual sources don't deal
with such simple stuff.

My current code is


# create a dictionary (dict) to store the order # and Remark
    testVariables = {}

# Read the file and load the dict
    input_file = open('test1Comma.csv', 'rU')
    for line in input_file:


I'm stuck on the code that comes next. what line of code loads the dict?

my csv file has 2 lines shown below.

AUTO-TEST-0021,REMARK 1
AUTO-TEST-0022,REMARK 2

Thanks in advance for the help.
-- 
<http://www.avant.ca/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140724/016d7925/attachment.html>


More information about the Tutor mailing list