Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

os.open vs open, what to use [duplicate]

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?

like image 206
Mattias Avatar asked Jun 11 '13 18:06

Mattias


1 Answers

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().

like image 110
A. Rodas Avatar answered Sep 19 '22 00:09

A. Rodas