Reading Information a Text File in Python

Опубликовано: 29 Сентябрь 2024
на канале: Access 2 Learn
1,304
13

http://access2learn.com/tutorial/pyth...

Like videos like this? Want to learn more about Python? Then check out this playlist:    • Intro to the Python Programming Language   and subscribe to the channel:    / @access2learn  

Reading data from a user typing it in, is helpful, but only in some instances. Being able to read persistent data (data that exists between times running the application), or large amounts of data will often require the use of reading a text file.

In this video I will show you how to read data from a file in three different ways, including reading the entire file into a variable, reading each line of the file manually, and using a loop to read the file line by line automatically for us.

I will also show you how to use rstrip to remove unwanted characters from your output.