Skip to content

Instantly share code, notes, and snippets.



Last active Feb 11, 2021
What would you like to do?
Messing with linecache
size, mtime, lines, fullname = linecache.cache[fname]
lines[lineno - 1]
# ' return random.randint(minimum, maximum)\n'
lines[lineno - 1] = "Nothing to see here, please move along..."
linecache.getline(fname, lineno)
# 'Nothing to see here, please move along...'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment