[plug] Quick Python question
Bernd Felsche
bernie at innovative.iinet.net.au
Fri Jul 2 12:21:24 WST 2004
I want to save the standard input into a scratch file in Python.
Will
import sys
import tempfile
tempfile.tempdir = '/tmp'
# save input to scratch file
scratch, scratch_name = tempfile.mkstemp(suffix='', prefix='maildoc.')
scratch.write(sys.stdin.read())
scratch.close()
in 2.3 do the trick? For arbitrary input content?
Seems like mkstemp is new with Python 2.3 so a few more hoops in 2.2.
--
/"\ Bernd Felsche - Innovative Reckoning, Perth, Western Australia
\ / ASCII ribbon campaign | I'm a .signature virus!
X against HTML mail | Copy me into your ~/.signature
/ \ and postings | to help me spread!
More information about the plug
mailing list