On 2016-04-26 07:18, +dime+ wrote: > I am learning python. > > if I have a csv file, like this > banana,4.0 > apple,3.5 > orange,3.0 > > Can anyone show me how to read the csv file line by line and then > create a dictionary to contain these keys and values?
import csv
with open('data.csv') as f:
data = dict(csv.reader(f))
Hard to get much more straight-forward.
-tkc
--
https://mail.python.org/mailman/listinfo/python-list
