"Lanny" <[EMAIL PROTECTED]> writes:

> Well the othe day I was making a program to make a list of all the
> songs in certian directorys but I got a problem, only one of the
> directorys was added to the list. Heres my code:
>
> import random
> import os
> import glob

If you need recursive traversal of directories, try os.walk.  For
example:

mp3s = []
for root, subdirs, files in os.walk(r'C:\Documents and Settings\Admin\My 
Documents\Downloads'):
    for f in files:
        if f.endswith('.mp3'):
            mp3s.append(os.path.join(root, f))
# mp3s is now a list of mp3 files under
# C:\Documents and Settings\Admin\My Documents\Downloads
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to