Save this video free

Python (Fall 2026) Module 12-1: Introducing File Usage in Python

Bill Moseley, Ph.D. - Computer Science Educator · 12:28 · Watch on YouTube

Python (Fall 2026) Module 12-1: Introducing File Usage in Python Watch on YouTube →

Overview

Bill Moseley introduces Python files as a way to preserve program data beyond a run, unlike variables that disappear when the program exits. He explains how `open()` connects a filename or path to a file object, then distinguishes read, append, write, and create modes while emphasizing the risk of overwriting important files.

Key takeaways

Chapters

0:00 Why Python Programs Need Files for Persistent Data
2:39 Using `open()` with Filenames and File Paths
9:28 Choosing Read, Append, Write, and Create Modes

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 So, we are going to do something very exciting  today. We are going to move into, or start moving into, the realm of making real programs that are  actually useful. What I mean by that is we can finally start thinking about saving data that's  produced by our programs in between using those programs. So, for example, the bank account,  the ATM, right? Every time we restart that ATM, our balances go back to whatever they were at the  start. That's not useful. That's not realistic. If it was a real bank account, or like an accounting  software, or something that helped us keep track of our monthly budget and spending, like it has  to save that data. Every, cuz even if we are like,

0:57 "No, no, I don't need to worry about saving. I'm  just going to leave this running on my computer." At some point, you know, your dog's going to  trip over the power cord and your computer's going to become unplugged, or there's going to  be a power outage, or something will happen. And your computer will no longer be running, so you  have to restart the program. And if you lose all your data at that point, it's going to be very  frustrating. Right now, our capabilities are sort of like if Microsoft Word required you to  sit down, write a whole paper without stopping, and then print it out before you left the computer  lab. That's just not feasible, nor is it useful. But now, with the introduction of files, we will  actually be able to save data in a more permanent way. Okay? So, the difference between saving data  and not saving data is that right now what we've

1:57 been doing is just running a program that, that  keeps the data in working memory. And when Python

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.