Skip to content

Instantly share code, notes, and snippets.

@koreno
Last active February 11, 2021 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koreno/f1f4164cb478d7a4188f71fdc5189742 to your computer and use it in GitHub Desktop.
Save koreno/f1f4164cb478d7a4188f71fdc5189742 to your computer and use it in GitHub Desktop.
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