We first open a file in a "with" statement—the syntax to do this is straightforward. Then we call csv.reader, which creates a reader. We specify here that the delimiter is a comma.
import csv
# Open CSV file.
with open(
"C:/programs/file.csv", newline=
"") as f:
# Specify delimiter for reader.
r = csv.reader(f, delimiter=
",")
# Loop over rows and display them.
for row in r:
print(row)
one,two,three,4
cat,dog,mouse,5
['one', 'two', 'three', '4']
['cat', 'dog', 'mouse', '5']