Categories
file python python-3.x

os.open vs open, what to use

I’m new to python and, looking at the docs, saw that there are at least two ways of opening a file for access os.open and open. What is the difference between os.open and open?

When should I use os.open?

When should I use open?

It is mentioned in the documentation of os.open:

Note: This function is intended for low-level I/O. For normal usage, use the built-in function open(), which returns a file object with read() and write() methods (and many more). To wrap a file descriptor in a file object, use fdopen().