These functions operate on I/O streams referred to using file descriptors.
fd) |
fd) |
fd, fd2) |
fd) |
fd, name) |
pathconf_names
dictionary. For configuration variables not
included in that mapping, passing an integer for name is also
accepted.
Availability: Macintosh, Unix.
If name is a string and is not known, ValueError is
raised. If a specific value for name is not supported by the
host system, even if it is included in pathconf_names
, an
OSError is raised with errno.EINVAL for the
error number.
fd) |
fd) |
fd) |
If you're starting with a Python file object f, first do
f.flush()
, and then do os.fsync(f.fileno())
,
to ensure that all internal buffers associated with f are written
to disk.
Availability: Macintosh, Unix, and Windows starting in 2.2.3.
fd, length) |
fd) |
True
if the file descriptor fd is open and
connected to a tty(-like) device, else False
.
Availability: Macintosh, Unix.
fd, pos, how) |
0
to set the position
relative to the beginning of the file; 1
to set it relative to
the current position; 2
to set it relative to the end of the
file.
Availability: Macintosh, Unix, Windows.
file, flags[, mode]) |
0777
(octal), and the current umask
value is first masked out. Return the file descriptor for the newly
opened file.
Availability: Macintosh, Unix, Windows.
For a description of the flag and mode values, see the C run-time documentation; flag constants (like O_RDONLY and O_WRONLY) are defined in this module too (see below).
) |
(master, slave)
for the pty and the tty,
respectively. For a (slightly) more portable approach, use the
pty module.
Availability: Macintosh, Some flavors of Unix.
) |
(r,
w)
usable for reading and writing, respectively.
Availability: Macintosh, Unix, Windows.
fd, n) |
sys.stdin
, use its
read() or readline() methods.
fd) |
fd, pg) |
fd) |
fd, str) |
sys.stdout
or sys.stderr
, use
its write() method.
The following data items are available for use in constructing the flags parameter to the open() function.
See About this document... for information on suggesting changes.