import datetime
content = input("What do you want to say to Mr. Diary? ")
if len(content) > 0:
with open('diary.txt', "a") as file_obj:
today = str(datetime.date.today())
file_obj.write(today + ": " + content + "\n")
with open('diary.txt', "r") as file_obj:
lines = file_obj.readlines()
print("".join(lines[-3:]).rstrip())