Write Lists as CSV Records (Exercise)
00:00 Welcome to the second section of this Python Basics Exercises course, which will test your ability to work with comma-separated values files in Python. CSV files are more specific text files suitable for storing tabular data.
You’ll start this exercise from the following Python code snippet. It defines a variable named
numbers, which references a nested list. Notice that each element of the outer list is a list itself, which contains the subsequent integer.
In algebra, such tables are quite popular and known as matrices. Now your goal is to take each row of numbers stored in that variable and write it to a CSV file called
numbers.csv, which should be located in your home directory.
Become a Member to join the conversation.