Complete the code to open a CSV file named 'data.csv' for reading.
with open('data.csv', [1]) as file: print(file.read())
To read a file, you open it with mode 'r'.
Complete the code to import the module needed to work with CSV files.
[1] csvThe correct way to import a module in Python is using 'import'.
Fix the error in the code to read rows from a CSV file using csv.reader.
with open('data.csv', 'r') as file: reader = csv.[1](file) for row in reader: print(row)
The csv module uses csv.reader() to read CSV files row by row.
Fill both blanks to write rows to a CSV file using csv.writer.
with open('output.csv', [1]) as file: writer = csv.[2](file) writer.writerow(['Name', 'Age'])
To write to a file, open it with 'w' mode and use csv.writer() to write rows.
Fill all three blanks to create a dictionary from CSV rows using csv.DictReader and print the 'Name' field.
with open('data.csv', [1]) as file: reader = csv.[2](file) for row in reader: print(row[[3]])
Open the file for reading, use csv.DictReader to read rows as dictionaries, then print the 'Name' field.
