Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 19, 2018 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/cccb5b7cb30084d2981e6dc2dd51f88e to your computer and use it in GitHub Desktop.
Save Fhernd/cccb5b7cb30084d2981e6dc2dd51f88e to your computer and use it in GitHub Desktop.
Creación de archivos temporales. OrtizOL.
from tempfile import TemporaryFile, NamedTemporaryFile
with TemporaryFile('w+t') as f:
f.write('Python es tremendo!\n')
f.write('La era Python ha empezado!\n')
f.seek(0)
print(f.read())
with NamedTemporaryFile('w+t') as f:
print(f.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment