When Python reads a file line-by-line, it doesn't store the whole file in memory all at once. Files are lazy iterables, and as we loop over a file object, we'll get lines from that file.
Read an article version of this video at https://pym.dev/reading-files-line-line/
Find more Python screencasts at https://pym.dev/screencasts/
00:00 Looping over file objects to read line-by-line
00:53 Getting rid of the newline character when reading line-by-line
01:04 File objects are lazy iterables
01:26 Recap: to get lines from a file, loop over the file object
Watch video Reading files line-by-line in Python online without registration, duration hours minute second in high quality. This video was added by user Python Morsels 20 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 914 once and liked it 31 people.