Chapter 1

Working with External Files

IN THIS CHAPTER

Bullet Understanding text and binary files

Bullet Opening and closing files

Bullet Reading a file's contents

Bullet Looping through a file

Bullet Reading and copying binary files

Bullet Conquering with CSV files

Bullet From CSV to dictionaries and objects

Pretty much everything that’s stored in your computer, be it a document, program, movie, photograph … whatever, is stored in a file. Most files are organized info folders (also called directories). On a Mac you can use Finder to browse around through folders and files. In Windows you use File Explorer or Windows Explorer (but not Internet Explorer) to browse around through folders and files.

Python offers many tools for creating, reading from, and writing to many different kinds of files. In this chapter, you learn all the most ...

Get Python All-in-One For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.