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

linecache.getline

Prev: linecache.clearcache | Up: linecache | Next: linecache.lazycache
Rel: linecache.checkcache, linecache.clearcache, linecache.lazycache
Ref: docs.python.org — linecache.getline
Tags: #public #python3 #stdlib #linecache


Import

import linecache
from linecache import getline

Signature & Overview

linecache.getline(filename, lineno, module_globals=None)

Get a line for a Python source file from the cache.

Usage

import linecache

line = linecache.getline(linecache.__file__, 1)
assert isinstance(line, str) and len(line) > 0

Gotchas

REPL Inspect

from linecache import getline
help(getline)

Linked from

Related notes