我30天科技成长的第二天
嘿,HN社区!
我的30天技术成长挑战的第二天已经完成。昨天,我构建了一个简单的命令行应用程序,用于收集和展示我最喜欢的名言。今天,我通过引入文件处理对其进行了升级,现在名言会永久保存在一个名为“quotes.txt”的文件中——即使在我关闭程序后也不会丢失。
我添加了以下功能:
1. 使用Python的“open()”函数将名言保存到文件中
2. 在应用程序启动时将名言读取回应用中
3. 根据用户输入从文件中删除名言
4. 养成将逻辑拆分为干净、可重用函数的习惯
这很简单,但从“仅仅打印内容”到实际存储和处理数据的转变,感觉是一个重大进步。这就像是给我的程序赋予了记忆。
我在这个过程中记录下所有内容,并会持续发布我的每日进展,以保持自我监督并在公众面前成长。
再次感谢在第一天鼓励我的HN朋友们——你们真棒!
Taiye Emmanuel
查看原文
Hey HN!
Day 2 of my 30-day tech growth challenge is complete
Yesterday, i built a simple CLI app to collect and display my favorite quotes. Today i upgraded it by introducing file handling so that quotes are now saved permanently in a 'quotes.txt' file - even after i close the program.
Here's what i added:
1. Saving quotes to a file using python's 'open()' function
2. Reading the quotes back into the app when it starts
3. Deleting quotes from the file based on the user's input
4. Building the habit of breaking logic into clean, reusable functions<p>It's simple, but this shift from "just printing stuff" to actually storing and manipulating data feels like a major step forward. It's like i gave my program a memory.
I'm documenting everything as i go, and i'll keep posting my daily progress to keep myself accountable and growing in public.
Thanks again to the HN folks who encourage me on Day 1 - you're awesome!
Taiye Emmanuel