CSV-File has string for every line. How can I transform it to use it for VS Code?

155 views Asked by At

I am trying to import a csv-File and make a dictionary out of it. The problem is that every line is in a string.

For example like this:

""First Name", "Last Name", "Date of Birth""
""Alex", "Turner", "08.09.1978""
""Max", "Parker", "16.02.2003""
""Mike", "Johnsen", "04.12.1999""

I tried to transform it into utf-8 because maybe thought that would be the problem but didn`t work.

import csv

csv_filename = 'Pläne.csv'

with open(csv_filename, encoding='utf-8') as f:
    plaene_dict = csv.DictReader(f)

I have to delete all the double quotes at the beginning and end of every line to get a dictionary out.

Had someone this problem before? How can I transform the csv to be fine for the input. Also have no idea to work around and to delete all the " with python before transform it into in dict. Anyone an idea?

Thanks a lot.

maxmyh

EDIT: Here is a Link to get a sample of the file https://www.transfernow.net/dl/20221109C4Av4YIO

0

There are 0 answers