Random Problems

Cousin Stanley cousinstanley at gmail.com
Thu Aug 14 20:02:55 CEST 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 

> From: Edwin.Madari at verizonwireless.com
>   To: "Cousin Stanley" <cousinstanley at gmail.com>, 
>        python-list at python.org
> Date: Yesterday 07:28:18 pm 

> use songs.extend( asongs )  # append is for single item 
>                             # - where ever it might be.

>>> l1 = range(5)         
>>> l2 = range(5,10)
>>> l1
[0, 1, 2, 3, 4]
>>> l2
[5, 6, 7, 8, 9]
>>> l1.extend(l2)
>>> l1
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>>

  And .... 

    Thanks to Edwin Madari for reminding me about
    the  extend  method available for lists which
    I had totally forgotten about ....


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona




More information about the Python-list mailing list