On Tuesday, 10 January 2017 12:31:52 GMT William R Sowerbutts wrote:
> You need to add the directory prefix to the result of os.listdir().
> 
> So if you do os.listdir('foo') it will return ['bar', 'jam']. When you pass
> these to mpg321 you want the directory name prefixed ie ['foo/bar',
> 'foo/jam'].
> 
> So try this:
> 
> subdir = './Playlist1'
> mp3_files = sorted(os.path.join(subdir, x) for x in filter(lambda f:
> f.lower().endswith(".mp3"), os.listdir(subdir)))

Thanks Will, that worked.

-- 



                Terry Coles

-- 
Next meeting:  Bournemouth, Tuesday, 2017-02-07 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to