The linecache module

This module is used to read lines from module source code. It caches recently visited modules (the entire source file, actually).

Example: Using the linecache module
# File: linecache-example-1.py

import linecache

print linecache.getline("linecache-example-1.py", 5)

$ python linecache-example-1.py
print linecache.getline("linecache-example-1.py", 5)

This module is used by the traceback module.

 

[comment on/vote for this article]

A Django site. this page was rendered by a django application in 0.00s 2012-05-25 15:55:15.827739. hosted by webfaction.