Today I learnt all about files, paths and directories. I learnt what a relative and absolute file path is as well as how to use both in Pycharm alongside reading and writing files. Rather than doing a singular main project I did multiple small ones, including upgrading my Snake game to have a high score that stays every time you load the game.
This is one of the mini-projects that I did -
with open("C:/Users/hirav/Desktop/Python Projects/Mail Merge Project/Input/Names/invited_names.txt", "r") as file:
invited_names = file.read().splitlines()
with open("C:/Users/hirav/Desktop/Python Projects/Mail Merge Project/Input/Letters/starting_letter.txt") as letter:
base_letter = letter.read()
for name in invited_names:
with open(f"C:/Users/hirav/Desktop/Python Projects/Mail Merge Project/Output/ReadyToSend/letter.to.{name}.txt", "w") as email:
email.write(base_letter.replace("[name]", name))