24/100일

작성자

카테고리:

← 피드로
DEV Community · Palak Hirave · 2026-08-08 개발(SW)

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))

Enter fullscreen mode Exit fullscreen mode

원문에서 계속 ↗

추출 본문 · 출처: dev.to · https://dev.to/hirave_palak/day-24-of-100-4b92

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다