[Tutor] listdir()

Isr Gish isrgish at fastem.com
Mon Jul 5 07:11:41 CEST 2004

Hi Ole,

-----Original Message-----
   >From: "Ole Jensen"<learning.python at dbmail.dk>
   >Sent: 7/2/04 8:22:17 AM
   >To: "tutor at python.org"<tutor at python.org>
   >Subject: [Tutor] listdir()
   >Hello list
   >I have recently learnt of the os.listdir() function, and I intend to experiment with it using a cgi-page (html). I would like to have a base directive show all the files and folders, so that the user can browse through it all. 
   >Now, listdir() returns both the files and folders in one big mess, so I am wondering if there is some ListFolderInDir() function or similar within python that I should use, if so what is its name and location.

There is a function called os.walk (not os.path.walk) that returns a tuple of,
(dirpath, dirnames, filenames)


   >Ole Jensen

All the best,

More information about the Tutor mailing list