(_, _, filenames) = os.walk(mypath).next() #if you are confident that the walk will return at least one value