How to check if it is a folder in Python

1 min

Another Python programmer's best friend, the os.path.isdir() method.

When your are building an archive system that will store all your processed data it might come in handy to use the os.path.isdir() method.

This method will check whether the selected path is a folder.

Here is the code

os.path.isdir("bob")

Here you are! You now know how to check if a path is a folder using the os.path.isdir() method.

More on fundamentals

If you want to know more about Python fundamentals without headaches... check out the other articles I wrote by clicking just here:

Fundamentals - The Python You Need
We gathered the only Python essentials that you will probably ever need.