I need to run a linux command line program from python. The input to the command line is a path and file name of a data file. There are literally thousands of these commands that need to be run and I first need to create the data file from a process in python. The output of the command line program needs to be read by python as well. It would be so much easier (and faster considering file reading and writing time) to replace the file name with the actual content somehow, and read the output which is to an output file directly into a python string without requiring disk file access. Is this possible, and how can this be implemented?
Imagine:
$ command < infilename > outfilename
or
$ command --infile filename --outfile filename
replaced by
$ command < {infile content} > {outfile content}
on the command line or something similar in python.