linecache

linecache — Random access to text lines

Source code: Lib/linecache.py

The linecache module allows one to get any line from any file, while attempting to optimize internally, using a cache, the common case where many lines are read from a single file. This is used by the traceback module to retrieve source lines for inclusion in the formatted traceback.

The 登录查看完整内容