How to get a list of all the folders in current directory. I know that we can get list of files and folders with os.walk() but I do not want to do the extra work as it is just unnecessary in my case.
[f for f in os.listdir('.') if os.path.isdir(f)]
print [fname for fname in os.listdir(".") if os.path.isdir(fname)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With