In this video, Kathryn teaches you about seeking: What it is, how to do it in Python, and why it is needed for reading a given file multiple times.
[Instructor] - Before going more into files,…let's take a look at what it means to seek.…In all files, we have a seek pointer…that points to a specific character in that file.…When we read or write, the seek pointer moves.…Ultimately, it keeps track of where we are…in the document, and before reading or writing,…it will be set to zero.…Let's say, in this file, we want to write H-A-P.…When the command executes, the program…will first input the H into the file.…After writing the H, our pointer will move…from zero to one.…
Next, the program will write the A in our H-A-P,…and our seek pointer again will move from one to two.…Lastly, we'll write a P to finish off our H-A-P,…and our pointer will move from two to three…after writing this letter.…We've written all that we wanted to in this file,…but now let's read it.…In order to read it, we must set the seek pointer…back to zero, and go through the file again.…We can do this with a function called Seek,…or we can close and reopen the file…in our Python program, which will reset the seek pointer…
- Working with logical and comparison operators
- Getting a list of numbers with the range() and list() functions
- Using mathematical functions such as round(), abs(), and pow()
- Calculating a given input's length
- Importing and using the math module
- Reading a user's command-line arguments
- Getting the current time
- Formatting dates and times with datetime
- Creating a timer
- Using urllib to get content from the Internet
- Using the JSON module to decode content
Skill Level Intermediate
Learning the Standard PHP Librarywith David Powers3h 24m Intermediate
1. Python: What's Built-In?
2. Python: Math
3. Python: Input/Output
4. Python: Date & Time, HTML Parsing, and HTTP
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.