If I have a file that has a content of this kind:
a,b
c,d
e,f
g,h
I need to make a list of the letters in the first column, i.e., [a, c, e, g]. I wrote some code which prints these letters but I don't know how to put them into a list. Here is the code:
def file_to_dict(f):
for line in f:
columns = line.split(",")
print columns[0]
Your help is appreciated.