MemotivaFile I/O and serialization

What is the difference between text mode and binary mode?

File I/O and serialization

Audio flashcard · 0:15

Nortren·

What is the difference between text mode and binary mode?

0:15

Text mode, the default, returns strings and handles newline conversion and encoding. Binary mode, indicated by b in the mode string, returns bytes and reads raw bytes without any conversion. Use binary mode for non-text files like images or for precise byte-level control.
docs.python.org