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
We need to handle creating files in place using templates.
Treehouse Courses
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
Since we're using Flask and
0:00
Flask's Jinja2 templates use the same
curly braces as the placeholders for
0:01
the format method, we'll have to keep
that in mind when we create the files.
0:04
But less talk, more rock, right?
0:08
First let's make a dictionary
of final file locations and
0:10
the template that will be used for them.
0:14
And I'm gonna use the location as
the key and the template as the value.
0:16
You could switch those
around if you wanted,
0:19
whichever way makes more sense to you.
0:21
You could even do it as a two tuple or
a named tuple but I like dictionaries and
0:23
dictionaries are easy.
0:27
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