I build my first console app with Python, Let's me share you!


Hello guy’s !
It’s my first post and i wanna show you my first console app with python.
I'm still a novice, and this isn't a formal article, so please bear with me. I just want to learn, and I feel like I really enjoy anything automation-related. For example, I created a mini console app with Python that allows me to add ideas to a .txt file, a bit like a personal diary.
It's true, why look for a pen when you can just do python diary.py directly on your powershell and go wild!
More seriously, I wanted to know my programming level, especially with Python, and the good news is, I'm no longer at 0, but officially a "Beginner" (according to ChatGPT).
So let me explain a little bit about what I did:
First I imported datetime because I needed my ideas to be recorded chronologically but I had a conflict because I needed to use date and datetime so I named datetime something else: datemine but I don't know if it was really a good approach. Then I asked a question to the user because I want to be able to write but also read the file.
As you can see, depending on the response, the user (that is, me) can either write or read, or simply exit the program by pressing 3.
But I still wanted to be able to retrieve a specific record, it was complicated because, unlike databases, they don't have a unique identifier (ID). That's why I decided to do it differently:
I decided to search for an entry based on its date, automatically assigned when saving, as written in the code above. This allowed me to retrieve only one row, so to properly retrieve all my daily entries, all must be on the same row.
Also, if I save two ideas on the same day, I can only find the first one.
These are problems that I could solve or not, it will depend on my level of laziness in any case here is how it is executed:
And the file is like this :
That's it! Not very useful, but hey, we have to start somewhere, right?
If you weren't too bored and want to stay informed about my learning, don't hesitate to subscribe!
Bye bye!❤️
Subscribe to my newsletter
Read articles from Meda Mondonga directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
