When debugging, you sometimes want to see a string with a basic editor. For showing a string with notepad:
import os, tempfile, subprocess
def get_rand_filename(dir_=os.getcwd()):
"Function returns a non-existent random filename."
return tempfile.mkstemp('.tmp', '', dir_)[1]
def open_with_notepad(s):
"Function gets a string and shows it on notepad"
with open(get_rand_filename(), 'w') as f:
f.write(s)
subprocess.Popen(['notepad', f.name])