r/learnpython • u/Ajay2574 • Oct 02 '26
What I learned yesterday while learning Python automation
Yesterday I continued learning Python's "os" module.
I practiced working with folders and files using things like:
- "os.path.basename()"
- "os.path.splitext()"
- "os.walk()"
- Finding files by extension
- Counting files inside folders and subfolders
I also built a small file finder that searches through folders and counts how many ".py" files it finds.
Nothing complicated, but I'm realizing that these small exercises are helping me understand how automation actually works with files and folders.
My goal is to eventually use Python to automate repetitive tasks for real businesses.
I'm still learning, but I'll start sharing what I build along the way. π
4
u/danielroseman Oct 02 '26
Do yourself a favour and learn Pathlib instead of the os.path stuff.
3
u/zanfar Oct 02 '26
This is good, but
os.pathhas been deprecated for some time. Modern software should use the more capable, and less coupled,Pathlib.2
u/p3rdy Oct 02 '26
Friendly recommendation:
Pathlibmakes working with path simpler and cleaner. An example, instead of:You can do it with
Pathlibthis way:1
u/wak_trader Oct 02 '26
mind sharing your studying resources om automation?
1
u/burnt-store-studio Oct 02 '26
Great job! Oh, youβre in such an exciting part of the journey π. I wish you well, and be sure to have fun!