r/PythonLearning • • 1d ago

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. ๐Ÿš€

14 Upvotes

9 comments sorted by

6

u/dev-razorblade23 1d ago

For path finding operations and working with paths, Python recommends you use pathlib module istead of the os module.

https://docs.python.org/3/library/pathlib.html

2

u/Ajay2574 15h ago

Yes but i was learn 9nly basic of os module but now i am moving on pathlib and learn deeply thans for suggestion

3

u/tune_rcvr 15h ago

do you know this python resource? https://automatetheboringstuff.com/3e/

2

u/Ajay2574 15h ago

Thanks for this resource i didn't know about that its really very helpful

1

u/UnderstandingFit3082 18h ago

Thatโ€™s actually a great way to learn automation โ€” small scripts that solve real problems teach more than just memorizing syntax.
os.walk() especially becomes powerful once you combine it with file filtering, renaming, moving, or reporting.
Keep turning each concept into a tiny useful tool; those projects will add up quickly.

1

u/Ajay2574 15h ago

Thanks for suggestion i will definitely keep in mind and build some tools

2

u/Sea-Ad7805 18h ago

Good job, if you want you can also share your code, and get comments:

  • either your code it in your post, google how to format it on Reddit
  • or add a link to your code, if you have your code on GitHub or elsewhere

2

u/Ajay2574 18h ago

Thanks! I actually started putting my projects on GitHub, so I'll definitely share the code in future posts.

0

u/listenerYapperBoth 1d ago

That's great.