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

os.read

Prev: os.putenv | Up: os | Next: os.readlink
Rel: os.abort, os.access, os.chdir, os.chmod
Ref: docs.python.org — os.read
Tags: #public #python3 #stdlib #os


Import

import os
from os import read

Signature & Overview

os.read(fd, length, /)

Read from a file descriptor. Returns a bytes object.

Usage

import os

r_fd, w_fd = os.pipe()
try:
    os.write(w_fd, b"abc")
    assert os.read(r_fd, 10) == b"abc"
finally:
    os.close(r_fd); os.close(w_fd)

Gotchas

REPL Inspect

from os import read
help(read)

Linked from

Related notes