Hi currently trying to read in a very easy csv file that looks like this:

i don’t need the header, but i want all rows as a k,v in a dictionary but the writer overwrites the data with the last value, how do I keep these duplicates in order to keep all rows as k,v in my dict?
>Solution :
The convenient way to do it is using a defaultdict from the collections module:
# create some test data
with open("data.txt","w") as d:
d.write("test,test_one\ndata,plaza\ndata,plazo\ndata,plozo\ndoto,plaza")
then use
from collections import defaultdict
data = defaultdict(list)
with open("data.txt") as f:
f.readline() # skip header
# process remainder
for line in f:
line = line.strip() # remove \n
if line:
# extract key + value by splitting
key,value = line.split(',',2)
# and add it
data[key].append(value)
print(data)
# print converted
print(dict(data.items()))
Output:
defaultdict(<class 'list'>, {'data': ['plaza', 'plazo', 'plozo'],
'doto': ['plaza']})
# converted to normal dict
{'data': ['plaza', 'plazo', 'plozo'], 'doto': ['plaza']}
See How does collections.defaultdict work?