[Tutor] lists

David david at abbottdavid.com
Tue Jan 20 20:29:02 CET 2009


Norman Khine wrote:
> Hi,
> actually what I was trying to do carries from my last post, where my
> media files are a list that I want to add to the
>
> subprocess.call(['sox', ', '.join(media_list), 'list.wav'])
Something like this may work;

#!/usr/bin/python
import subprocess

def play(filename):
    player = "/usr/bin/sox"
    fname = "/home/yorname/dir/" + filname
    subprocess.call([player, fname])

def playall(files):
    for name in files:
        play(name)

def run():
    files =['wav1.wav', 'wav2.wav']
    playall(files)

run()

-- 
powered by Gentoo/GNU Linux
http://linuxcrazy.com



More information about the Tutor mailing list