Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Python for File Systems!
You have completed Python for File Systems!
Preview
Python has an entire module dedicated to temporary files, directories, and friends.
Python Documentation
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
saved to disk to reduce
their RAM footprint.
0:00
But either need to be thrown away
when you're done processing them, or
0:01
when the user decides
to cancel the process.
0:04
While there's quite a bit in the module,
we're only going to focus on two things,
0:07
temporary files and temporary directories.
0:11
Let's start with the directory,
so I've imported os,
0:13
I also want to import tempfile.
0:15
And I'm going to use with
0:18
tempfile.TemporaryDirectory() as
tmpdirname.
0:21
I'm gonna print,
Created temporary directory named,
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up