All right, guys, it's time to put what you've learned to the test. Now in this project, we're going
to be doing a little bit of mail merging.
So mail merging is where you take something like what
we have a list of names, for example, and we want to insert each of these names into a letter.
So instead of saying dear [name], you are invited to my birthday the Saturday, it should say dear
and then it would replace that with whatever is here.
Take a look at this example file.
You can see that it replaced the name placeholder with the first name in the invited_names.txt
file.
Your objective is to write some python code to automate the process.
So what you're going to end up with is a bunch of letters, one for each of the names inside the invited_
names.txt and the letters are going to be named like this: letter_for_ and
then the name of the person.
And they're going to be saved in a txt format, which you can open either in Google Docs or in Microsoft
Word.
And it's basically ready for printing.
So I've made it a little bit harder for you by adding in a whole bunch of folders.
And each of these files are nested inside a bunch of folders.
So, for example, starting letter is inside letters, which is inside input.
And then the letters that you're going to generate are going to need to go into this folder called Ready
ToSend, which is inside output. And no cheating.
I don't want you moving around any of these files.
You're going to be using what you've learned about directories and file paths to do everything without
needing to drag and drop or move anything around manually.
I've got some starting files for you.
So the first thing I want you to do is to go to the course resources and download the zip file, which
will be your starting project code.
Once you open it within PyCharm, it's going to ask you to configure the interpreter. So you can either
go ahead and click on that pop-up, or if it disappears, then just click on the event log and then click
on Configure Python Interpreter and then select the latest interpreter that you have installed.
So in my case, it's 3.8, but by the time you're watching this, it'll probably be
3.9 or even later.
And once that's done, then you can go ahead and have a look inside main.py.
So here I've got some instructions for you.
First, you're going to create a letter using the starting_letter.txt, which is right here
nested two folders deep, and then you're going to use each of the names inside invited_names.
txt to replace the part where it says name with the actual names that you see in invited_names.txt.
And then you're going to save each of those letters that you've generated inside the folder ReadyTo
Send.
And you can take a look at the example if you want to see what the final outcome looks like.
So it's going to be the name without any spaces afterwards, just a comma.
Now there's going to be a few things that will trip you up along the way.
And I'm hoping that you're going to use your knowledge about how to get help from Google and Stack overflow,
as well as some of these hints that I've left in here for you.
So the hints take you to three pages of Python documentation, and they're chosen because the methods
that are featured in them will definitely help you in this project.
In fact, some of the things that you're going to try to do won't be possible unless you take a look
at each of these pages of documentation, read through it, and understand what the methods do.
Now, as always, with a lot of tutorials, it's impossible to teach you every single method.
And it would be really, really tedious if I just went through all of the methods that are available in Python
and showed them to you individually.
So instead, you have to work just as a pro developer does which is to find out information when you
need it and to quickly understand what's happening and how to use the information you found on the fly.
Don't worry if you haven't seen me use these methods before. You will get more practice by using
the documentation, figuring things out yourself, and implementing things that you haven't seen before.
Once you're ready, go ahead and take a look at each of these links, see what each of the methods I've
linked to does, and then go ahead and try to tackle this challenge.
So pause the video and I'll see you on the other side.