In this project I need to read the input file with unknown data and put it in a dictionary. The first column will always be name, while the rest will always be values. However, we don't know have many column for the values can it contain. For example:
name1;1;2;3;4
name2;1;1;1
name3;5;6
name4;9
I was thinking using split(';') but each row might have different columns.
for line in file:
line = line.rstrip()
name, value = line.split(';')
ValueError: too many values to unpack
Wanted final result:
d={name1:[1,2,3,4], name2:[1,1,1], name3:[5,6], name4:[9]}
Thank you so much for your help!