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

Опубликовано: 21 Ноябрь 2024
на канале: 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