python - How to grab files generated by a subprocess? -
i want run command line scripts within python program. these scripts generates output files. want grab these output files subprocess call object in python program, while canceling generation of files on disk. problem don't know how it, or whether possible.
a simple example this:
#foo.py fout1 = open("temp1.txt","w") fout2 = open("temp2.txt","w") fout1.write("fout1") fout2.write("fout2") fout1.close() fout2.close() #test.py import subprocess process = subprocess.popen(["python","foo.py"], ????????) #what arguments use grab temp1.txt , temp2.txt print(process.??????) #how access files i familiar subprocess.popen example code uses, open use of other modules if it.
Comments
Post a Comment