Save this video free

Lecture 13: File Reading 1

Professor Rosen · 1:06:25 · Watch on YouTube

Part of Temple University CIS 1051. See all 23 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Professor Rosen introduces Python file handling through text and binary file examples, then demonstrates how file locations, relative paths, and operating-system conventions affect whether Python can open a file. Using Project Gutenberg’s Treasure Island text and the Lab 7 Hurricane Irma tracker, the lecture covers `open()`, `read()`, `readlines()`, line-by-line iteration, UTF-8 encoding, and the `data/` subfolder paths needed to load CSV data.

Key takeaways

Chapters

0:00 Why Python File Reading Requires Knowing Where Files Are
4:00 Text Files, Binary Files, CSV, and Markdown
11:30 Lab 7: The Hurricane Irma Turtle Tracker
17:00 Creating Two Python Files in the Same Folder
22:00 Python’s `open()` Compared with Java and C File Reading
32:00 Absolute Paths, Relative Paths, and Project Gutenberg
39:00 Downloading Treasure Island as a Plain-Text File
44:00 Fixing File-Not-Found Errors and Selecting File Modes
47:00 Reading an Entire File with `read()`
49:30 Using `readlines()` to Store File Lines in a List
54:00 Iterating Through a File and Counting Pirate Vocabulary
58:00 Unzipping Lab Files and Preserving the Archive Structure
1:03:00 Loading Hurricane Data from the `data/` Subfolder

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

Transcript excerpt

0:00 recording. Okay, chapter nine readings. Let's go ahead and go straight to the textbook just to kind of show it. Um, transforming sequences. So, this talks about how we move with uh mess with sequences and and uh and the like, but especially 10. This is what we're talk talking about today. Um, which is going over files. Now, part of what I love about um about this um textbook is that it can have like te um files kind of just stored on your computer that you can open and close no uh no problem. right here. Like for instance, here it

0:48 has a uh stuff about the Olympics and it I can just load that up and then we'll learn how to do this in a minute. file ref and then we can print that and it it basically it prints it out. So basically it's allows us to have like a file open on our um it allows us to like practice how we do a reading and writing of a file without having to install it on a computer, download it to a computer which is going to be the focus of today's lecture. uh finding a file on your file system.

1:37 Um so and like I really I hate saying this to y'all because it's like a very much a kids these days kind of thing but it is a trend that we have noticed um which is a result of the way we have chain uh we collectively have all changed with how we use computers design computer systems and interact with computer systems. So I guess I will just simply go straight to kids these days don't know how their file system is structured because you don't need to right you just kind of

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

In this course

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, Professor Rosen.

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.