By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

how to run through a loop consisting of os.system

P: 1
i have to generate a quality score for speech files using an executable called pesq_tool.exe. i wanna do this using python for a number of speechfiles. i could achieve the task for one set of speech files as follows
import os
os.system("C:\Python27\pesq_tool.exe +16000 or105.wav dg105.wav")
as write above the tool takes three arguments, the first one is fixed and the other two are speech files to be given as input. i have stored the speech files in two different folders. both in c drive. now how do i give the rest of the speech files as inputs to the tool? i wanna do this using a loop.
kindly help
regards
amit
Apr 9 '11 #1
Share this Question
Share on Google+
1 Reply


bvdet
Expert Mod 2.5K+
P: 2,851
Get a list of the file names with fnmatch.fnmatch, glob.glob, or os.listdir. After compiling a list of the full path names of the files that you want to process, you would then iterate on the list in a for loop.
Apr 10 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.