Common constants
Several input/output related constants can be imported from the standard module Fcntl.
Constants related to open and sysopen are imported by default. For some constants, the widely accepted values are shown in octal.
Value | Name | Description |
|---|---|---|
|
| Read-only access. |
|
| Write-only access. |
|
| Read and write access. |
|
| Create the file if nonexistent. |
|
| Fail if the file already exists. |
|
| Append data to the end of the file. |
|
| Truncate the file. |
| Nonblocking input/output. | |
| Same as | |
| Synchronous input/output. | |
| Lock exclusive. | |
| Lock shared. | |
| File must be a directory. | |
| Do not follow symlinks. | |
| Use binary mode for input/output. | |
| Allow file to be larger than 4 GB. | |
| Terminal will not become the controlling tty. |
Constants related to seek and sysseek must be imported explictly by specifying :seek in the import list of Fcntl.
Value | Name | Description |
|---|---|---|
|
| Seek position. |
|
| Seek offset from current position. |
|
| Seek offset from end of file. |
Constants related to flock must be imported explictly by specifying :flock in the import list of Fcntl.
Value | Name | Description |
|---|---|---|
|
| Shared lock. |
|
| Exclusive lock. |
|
| Non-blocking lock. |
|
| Unlock. |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access