So have a "file.csv" and I want to extract some data from it using Python.
The problem for me is that the lines are formatted not in standard csv format, but instead a line looks like this:
;a_value=value;b_value=value;
So my idea was to use .replace()
to edit everything in a line so that in the end it looks as wished:
'a_value':'value', 'b_value':'value'
In order to iterate and modify every line I followed the idea from this question from Modify csv files?
But I get:
AttributeError: 'str' object has no attribute 'readline'
My code:
with open(name_file, "r") as csv_file:
data=name_file.readlines()
csv_file=close()
csv_file=open(name_file, "w")
for row in csv_file:
#Replace commands
f.close()