I want to open and read file Mappe1.csv but it is not working. I am using Python 3.6.5 Anaconda. I do not know what I am doing wrong. Any ideas?
File Mappe1.csv contains:
A;B;C
1;4;7
2;5;8
3;6;9
The python code for opening Mappe1.csv looks like the following:
import csv
class CSVAdapter:
def read_csv(self):
with open("C:/Users/User/PycharmProjects/General/DesignUploader/Mappe1.csv") as file:
dialect = csv.Sniffer().sniff(file.read(1024))
csv_file = csv.reader(file.readlines(), dialect, quotechar='"')
print("A")
csv_file_list = []
for row in file:
print("B")
for row in csv_file:
print("C")
csv_file_list.append(row)
return csv_file_list
The printout is "A" only. "B" and "C" does not get printed which leads me to the conclusion that the file was not read correctly.
Are there any python/windows settings required to allow Python to read a file?
Thank you for your help!