Guest User

Untitled

a guest
Feb 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. # add.py 3 5
  2. import runpy
  3. import sys
  4.  
  5. # Is it safe to hack sys.argv like this?
  6. orig_argv = sys.argv
  7. sys.argv = "add.py 3 5".split()
  8. runpy.run_path("add.py", run_name="__main__")
  9. sys.argv = orig_argv
  10.  
  11. # And is it safe to hack sys.stdout if we want to get its output?
Add Comment
Please, Sign In to add comment