In a file like:
jaslkfdj,asldkfj,,,
slakj,aklsjf,,,
lsak,sajf,,,
how can you split it up so there is just a key value pair of the two words? I tried to split using commas but the only way i know how to make key/value pairs is when there is only one commma in a line.
python gives the error: "ValueError: too many values to unpack (expected 2)" because of the 3 extra commas at the end of each line
this is what i have:
newdict= {}
wd = open('file.csv', 'r')
for line in wd:
key,val = line.split(',')
newdict[key]=val
print(newdict)