Reading records from a CSV file

As a first approach to loading read-only data into our application, we will use a comma-separated values (CSV) file. This format tabulates data in plain text files, where each file corresponds to the fields of a record, separated by commas, like so:

Gauford,Albertine,[email protected],(614) 7171720
Greger,Bryce,[email protected],(616) 3543513
Wetherald,Rickey,[email protected],(379) 3652495

This solution is easy to implement for simple scenarios, especially if the text fields do not contain line breaks. We will use the csv module from the standard library, and once the records are loaded into our application, we will populate the widgets developed in the previous recipes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset