What are the different modes a file can be opened with?


#1

Question

What are the different modes a file can be opened with?

Answer

Python’s open() function is capable of opening a file with several different mode options, which come in handy for different use cases! Below is a list of all the modes available, as seen on the documentation page:


Learn Python - File Input / Output - Reading