Listing Directories
import os os.listdir("c:\\") dirname = "c:\\" os.listdir(dirname) print [f for f in os.listdir(dirname) if os.path.isfile(os.path.join(dirname, f))] [3] print [f for f in os.listdir(dirname) if os.path.isdir(os.path.join(dirname, f))] [4]