Advertisement
tinypirate

THING WITH THE STUFF

May 30th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. #oh mY GOD IT EVEN HAS AN EDITING FUNCTION SARAH UR TOO GOOD LVL UP
  2.  
  3. import os, tempfile, subprocess
  4.  
  5. def get_rand_filename(dir_=os.getcwd()):
  6.     "Function returns a non-existent random filename."
  7.     return tempfile.mkstemp('.tmp', '', dir_)[1]
  8.  
  9. def open_with_notepad(s):
  10.     "Function gets a string and shows it on notepad"
  11.     with open(get_rand_filename(), 'w') as f:
  12.         f.write(s)
  13.         subprocess.Popen(['notepad', f.name])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement