ChatCrawlersearch across public Telegram Open the app
P

Python

сообщение · 2026-06-20 11:53 UTC
A
Hey everyone! I've been learning Python for 3 months now and just finished my first real project - a mood tracker that saves entries to a file with automatic dates. It's simple, but I'm proud of it. Any feedback or suggestions for improvement would be appreciated! 🙏 from datetime import datetime try: with open("mood.txt", "r", encoding="utf-8") as file: for line in file: line = line.strip() if line: history.append(line) except FileNotFoundError: pass while True: print("1. Add mood entry") print("2. Show all entries") print("3. Exit") choice = input("Choose action: ") match choice: case "1": mood = input("How are you feeling today? ") today = datetime.now().strftime("%Y-%m-%d") history.append(f"{today}: {mood}") print("Entry added!") case "2": if history: for record in history: print(record) else: print("History is empty") case "3": with open("mood.txt", "w", encoding="utf-8") as file: for record in history: file.write(record + "\n") print("Goodbye!") break case _: print("Invalid choice. Please enter 1, 2, or 3.")

Вся лента · оригинал в Telegram

Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog