with open("quotes.txt", "r", encoding="utf-8") as file:
print(file.read())
with open("quotes.txt", "a", encoding="utf-8") as file:
while True:
answer = input("Хотите добавить ещё одну цитату? (да/нет)")
if answer.lower() == "нет":
break
quote = input("Введите цитату: ")
author = input("Введите автора: ")
file.write(quote + "\n")
file.write("(" + author + ")\n\n")
with open("quotes.txt", "r", encoding="utf-8") as file:
content = file.readlines()
print("Список авторов:")
for line in content:
if line.strip().startswith("(") and line.strip().endswith(")"):
print(line.strip())