Random Problems

Lanny lanny at freshells.ch
Wed Aug 13 19:13:14 EDT 2008


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

songs = glob.glob('C:\Documents and Settings\Admin\My 
Documents\LimeWire\Saved\*.mp3')
asongs = glob.glob('C:\Documents and Settings\Admin\My 
Documents\Downloads\*\*.mp3')
songs.append(asongs)
asongs = glob.glob('C:\Documents and Settings\Admin\My 
Documents\Downloads\*\*\*.mp3')
songs.append(asongs)
asongs = glob.glob('C:\Documents and Settings\Admin\My 
Documents\Downloads\*\*\*\*.mp3')
songs.append(asongs)
pick = random.choice(songs)

all goes well but pick awalys is from the first directory but songs awalys 
includes all the files I want it to. Im baffaled. 



-- Posted on news://freenews.netfront.net - Complaints to news at netfront.net --



More information about the Python-list mailing list