Skip to main content

Section 11.1 Working with Data Files

So far, the data we have used in this book have all been either coded right into the program, or have been entered by the user. In real life, data reside in files.
For example, web pages, word processing documents, and all data that live in files. In this chapter we will introduce the Python concepts necessary to use data from files in our programs.
For our purposes, we will assume that our data files are text files–that is, files filled with characters. The Python programs that you write are stored as text files. We can create these files in any of a number of ways. For example, we could use a text editor to type in and save the data. We could also download the data from a website and then save it in a file. Regardless of how the file is created, Python will allow us to manipulate the contents.
You have attempted 1 of 1 activities on this page.