File I/O in Python: the readline function (reading text files one line at a time)

Published: 28 September 2023
on channel: PatchyPython
59
1

You usually want to read a text file one line at a time, using the "readline" function in conjunction with a loop. In this example, we use a while loop to read a simple file, and show what happens when you try to read past the end of the file. Check out the notebooks linked below for more information on file handling in Python.

Embedded video, part of the following courses:
Computer Programming at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/yc2tpdfs
Coding for Scientists at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/bdef2fcj

Notebooks will open on Google Colab - no installation required


Watch video File I/O in Python: the readline function (reading text files one line at a time) online without registration, duration hours minute second in high quality. This video was added by user PatchyPython 28 September 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 59 once and liked it 1 people.