Reading CSV Files to lists
Reading CSV Files into Python lists
Good for:
- Looping through the entire list of rows in the file and doing something for each row.
- Finding the highest, lowest and average for items in CSV rows.
Reading CSV files to Dictionaries
Reading CSV Files into Python Dictionaries
Good for:
- Where you just want find information about a specific item in a CSV file.
Writing to CSV Files
Tutorial Video
YouTube Blocked? Use the Google Drive version instead
Code
import csv f = open('namesages.csv','a',newline = '') name = input("What is your name?") age = input("What is your age?") row = (name,age) writer = csv.writer(f) writer.writerow(row) f.close() #really important!!!