Os Open
# Python2.x Python os.open() Method
[ Python OS File/Directory Methods](#)
* * *
### Overview
The os.open() method is used to open a file and set the required opening options. The mode parameter is optional and defaults to 0777.
### Syntax
The syntax of the **open()** method is as follows:
os.open(file, flags[, mode]);
### Parameters
* **file** -- The file to open
* **flags** -- This parameter can be one of the following options, multiple options are separated by "|":
* **os.O_RDONLY:** Open in read-only mode
* **os.O_WRONLY:** Open in write-only mode
* **os.O_RDWR :** Open in read-write mode
* **os.O_NONBLOCK:** Do not block on open
* **os.O_APPEND:** Open in append mode
YouTip