[Tutor] Using subprocess on a series of files with spaces
C Smith
illusiontechniques at gmail.com
Fri Aug 1 01:47:28 CEST 2014
Nice, these are useful tools. I have been building something with just
basic stuff and avoiding learning any libraries. If I wanted to get
some insight on a larger program that is about 1000 lines, would that
be doable here?
On Thu, Jul 31, 2014 at 7:37 PM, Peter Otten <__peter__ at web.de> wrote:
> C Smith wrote:
>
> I'd throw in a check to verify that filename is indeed a flac:
>
>> or more accurately
>> import os, subprocess, re
>> directory = '/abs/path'
>> for track, filename in enumerate(os.listdir(directory), 1):
>> pathname = os.path.join(directory, filename)
> if filename.endswith(".flac"):
> subprocess.call(['ffmpeg', '-i', pathname, filename[:-5]+'.mp3'])
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list