import csv
with open(file_name, mode ='r', encoding='utf-8') as file:
# reading the CSV file
csvFile = csv.DictReader(file)
# displaying the contents of the CSV file
for line in csvFile:
read csv file
Read a CSV file in Python
Regular read CSV file with the CSV library
For each line, use line["attributeName"]
to access the content.
Shortcut: csv.file.read
1 Comments
alexmartx 12/7/2021, 12:08:58 PM
0Useful recipe!
Add Comment
Log in to add a comment