AI engineering glossary · Python core

What is File I/O?

File I/O (also called open function): Reading data from and writing data to files using the built-in open() function, which returns a file object. The mode argument chooses reading ('r'), writing ('w'), appending ('a') or binary ('b'). Files should be closed after use.

Level: beginnerTopic: Python core

File I/O: an example

with open('notes.txt', 'w') as f: f.write('hello') creates a file containing hello.

Related terms

More Python core terms

Where you learn it

File I/O is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.