Question: How do I load a csv file from my computer desktop into my python program? Here's what I have so far, and it isn't pulling

How do I load a csv file from my computer desktop into my python program? Here's what I have so far, and it isn't pulling any info. I am creating a contact manager program that needs to read the csv file when it's opened.
import csv
import os
contacts =[]
def load_contacts():
if os.path.exists("contacts.csv"):
with open('contacts.csv', mode='r') as file:
reader = csv.reader(file)
for row in reader:
name, email, phone = row
contacts.append({"name": name, "email": email, "phone": phone})

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!