Introduction to file I/O in Python: opening files, closing them, and the readlines function

Published: 27 September 2023
on channel: PatchyPython
89
0

How to read and write data from/to a text file on the disk. I explain what a file handle is (that's your interface to the file) and how you can open and close a file. Finally I demonstrate the "readlines" function that allows you to "slurp up" the content of a text file in one go as a list of strings. 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 Introduction to file I/O in Python: opening files, closing them, and the readlines function online without registration, duration hours minute second in high quality. This video was added by user PatchyPython 27 September 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 89 once and liked it 0 people.