Created
April 13, 2016 00:39
-
-
Save carlos-jenkins/55ec04c8a9ba345b6b968c5ca11595f9 to your computer and use it in GitHub Desktop.
Creating named temporal files in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import fdopen | |
from json import dumps | |
from tempfile import mkstemp | |
payload = {'one': 1} | |
osfd, tmpfile = mkstemp() | |
with fdopen(osfd, 'w') as pf: | |
pf.write(dumps(payload)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment