PyDocs

Nav

File and Directory Access

getline

linecache

function (source)
  • getline(filename, lineno, module_globals=None)
Get a line for a Python source file from the cache.
Update the cache if it doesn't contain an entry for this file already.
Changed in 3.14
  • 3.14: Support filename of frozen modules.
1 Example
>>> import linecache
>>> linecache.getline(linecache.__file__, 8)
'import sys\n'
from the Python docs
See Also
No see-alsos for linecache/getline
0 Notes
No notes for getline