>> root, dirs, files = os.walk(dirname) If you want to do it this way, you need to stop it after the first one: root, dirs, files = os.walk(dirname).next() print root print dirs print files see this thread http://tinyurl.com/rmyo4