Advertisement
here2share

# open_tempfile.py

May 31st, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # open_tempfile.py
  3.  
  4. import os
  5. import tempfile
  6.  
  7. abc='''
  8. This is a basic demo
  9. which should create a
  10. temporary file then
  11. open Notepad to show
  12. this data as written.
  13. '''
  14.  
  15.  
  16. srcfilename = tempfile.mktemp(".txt", "demo")
  17. temp = open(srcfilename, 'w')
  18. temp.write(abc)
  19. temp.close()
  20. os.system("notepad.exe "+srcfilename)
  21.  
  22. print srcfilename
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement