-
Book Overview & Buying
-
Table Of Contents
Python Automation Cookbook - Third Edition
By :
Some text files contain tabular data separated by commas. This is a convenient way of creating structured data, instead of using more complex binary formats such as Excel. These files are called Comma Separated Values or CSV files, and most spreadsheet packages allow us to work directly with them.
We've prepared a CSV file using the data for the top 10 movies by theatre attendance, as described by this page: http://www.mrob.com/pub/film-video/topadj.html.
We copied the first 10 elements of the table into a spreadsheet program (Numbers) and exported the file as a CSV. The file is available in the GitHub repository in the ch04/documents directory as top_films.csv

Figure 4.2: Content of the CSV file
>>> import csv
>>> import csv
>>> with open('top_films.csv&apos...