KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to use tempfile.NamedTemporaryFile() to write some contents into it and then open that file. I have written following code: tf = tempfile.NamedTemporaryFile() tfName = tf.name tf.seek(0) tf.write(contents) tf.flush() but I am unable to open this file and see its contents in Notepad or similar application. Is there any way to achieve this? Why can't I do something like: os.system('start notepad.exe ' + tfName) at the end. I don't want to save the file permanently on my system. I just want the contents to be opened as a text in Notepad or similar application and delete the file when I close that application.
Tags (comma-separated)
Save Edits
Cancel