import sys, os from math import * def pipe(cmd): fp = os.popen(cmd) res = fp.read() stat = fp.close() return res, stat def main(script, filename='out.tr'): rhos = [rho/10.0 for rho in range(1, 10)] for rho in rhos: cmd = "./sim -v0 -n1000 -r%f" % (rho) res, stat = pipe(cmd) print res, if __name__ == '__main__': main(*sys.argv)