(new to python here) I'm creating a simple contacts list program in python that loads and saves the list-dict to a csv file. The program should load the data on the csv to the list-dict (when it is launched) and rewrite the data (the list-dict) to the csv when the program is closed. Is there a way to read/load all the data from the csv file at once to the list-dict as the "writer.writerows(list-dict)" exists for saving the data?
def load (contacts):
with open(list,"r") as myFile:
a = contacts
a = myFile.read()
print(a)
By the way, this is the outpout that I am getting:(for some reason, it seems that 'a' - that was supposed to be a list-dict - is not a list-dict) index,nome 1,asdf 2,qwer 3,xcv 4,ttt
What am I doing wrong?