Skip to Content
Modern Python Standard Library Cookbook
book

Modern Python Standard Library Cookbook

by Alessandro Molina
August 2018
Intermediate to advanced
366 pages
10h 14m
English
Packt Publishing
Content preview from Modern Python Standard Library Cookbook

Named temporary files

Usually when working with temporary files, we don't care where they are stored. We need to create them, store some content there, and get rid of them when we are done. Most of the time, we use temporary files when we want to store something that is too big to fit in memory, but sometimes you need to be able to provide a file to another tool or software, and a temporary file is a great way to avoid the need to know where to store such a file.

In that situation, we need to know the path that leads to the temporary file so that we can provide it to the other tool.

That's where tempfile.NamedTemporaryFile can help. Like all other tempfile forms of temporary files, it will be created for us and will be deleted automatically ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Python Development: Using Powerful Language Features in Real-World Applications

Advanced Python Development: Using Powerful Language Features in Real-World Applications

Matthew Wilkes

Publisher Resources

ISBN: 9781788830829Supplemental Content