On this page
  1. posix.dup
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

posix.dup

Prev: posix.DirEntry | Up: posix | Next: posix.dup2
Rel: posix.abort, posix.access, posix.chdir, posix.chflags
Ref: docs.python.org — posix.dup
Tags: #public #python3 #stdlib #posix


Import

import posix
from posix import dup

Signature & Overview

posix.dup(fd, /)

Return a duplicate of a file descriptor.

Usage

import os

r, w = os.pipe()
d = os.dup(r)
os.close(d); os.close(r); os.close(w)

Gotchas

REPL Inspect

from posix import dup
help(dup)

Linked from

Related notes