KalyanChakravarthy.net

Thoughts, stories and ideas.

List directories in python

Its pretty straight forward to list files, by using:

:::python
import glob
print glob.glob("*")

Listing directories especially only those in current level requires the use of os.walk

:::python
os.walk('content/').next()[1]