Skip to content

Commit d389655

Browse files
committed
feat: solve pb 44
1 parent 2432cce commit d389655

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

review/pb45/44.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
while True:
2+
key = input("메뉴\n1. 쓰기\n2. 읽기\n3. 종료\n>> 번호를 고르세요 : ")
3+
4+
if key == "1":
5+
with open("./44.txt", "a+") as f:
6+
f.seek(0)
7+
content = f.read()
8+
if content != "":
9+
print("[이전에 입력한 내용]")
10+
print(">>>>>>")
11+
print(content)
12+
print(">>>>>>")
13+
print("🎬 글쓰기 시작")
14+
text = input()
15+
f.write("\n" + text)
16+
print("\n✅ 글쓰기 완료")
17+
elif key == "2":
18+
with open("./44.txt", "r") as f:
19+
content = f.read()
20+
print("[입력한 내용]")
21+
print(">>>>>>")
22+
print(content)
23+
print(">>>>>>")
24+
print("\n✅ 파일 읽기 완료")
25+
elif key == "3":
26+
print(key)
27+
break

review/pb45/44.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
naverdaumhello worldhahaha
2+
네카라쿠배
3+
4+
당토
5+
끝끝끝
6+
gkgkgk

0 commit comments

Comments
 (0)