[Tutor] list packing

kevin parks kp8 at mac.com
Mon Feb 27 05:01:13 CET 2006


howdy,

I am using the os module to do some of my heavy lifting for me. I am 
tried of building lists
by hand so i decided that i would get python to look in a bunch of 
directories and stuff all the things it
find there into a list depending on it's extension.

Works great ... one problem sometimes i need just the filenames and 
that is fine, but more often i need
to feed the full path to my other functions.... yet i don't see *any* 
documentation on os.listdir() at all. I don't
know how to give me the full path ...

snd = [f for f in os.listdir('/Users/kevin/snd/') if f.endswith('.aif')]


cheers,

kevin



More information about the Tutor mailing list