Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 2_3_text_file_reader.py
- import csv
- # Without casting strings
- with open('golf_scores.csv') as csvfile:
- favourites = csv.reader(csvfile, delimiter=',')
- for row in favourites:
- print(row)
- # With casting strings
- with open('golf_scores.csv', newline='') as csvfile:
- favourites = csv.reader(csvfile, delimiter=',', quoting=csv.QUOTE_NONNUMERIC)
- for row in favourites:
- print(row)
- #next line will display the variables types for the data stored in the csv file
- #print(type(row[0]), type(row[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement