parallel subprocess.getoutput

Jaroslav Dobrek jaroslav.dobrek at gmail.com
Fri May 11 08:11:06 EDT 2012


Sorry, for code-historical reasons this was unnecessarily complicated.
Should be:


MY_DIR = '/my/path/to/dir'
FILES = os.listdir(MY_DIR)


def grep(regex):
    output = []
    for f in FILES:
        command = "egrep " + '"' + regex + '" ' + MY_DIR + '/' + f
        result = subprocess.getoutput(command)
        if result:
            output.append(result)
    return output



More information about the Python-list mailing list