Python script output in file

Rustom Mody rustompmody at gmail.com
Wed Mar 18 14:06:23 EDT 2015


On Wednesday, March 18, 2015 at 8:12:12 PM UTC+5:30, Robert Clove wrote:
> ./my_eth_script.pl eth0 M >> a.txt
> 
> How can i run this command with subprocess.popen

Something like this I guess?

>>> proc = Popen("cat", shell=True, stdout=open(inname, "w"), stdin=open(outname,"r"))

inname and outname should be appropriate input (existing) and output (to be created) files. ie put the strings directly there or assign to the variables
prior to the Popen call

And BTW 
Two suggestions
1. Read the docs
2. Dont top-post https://en.wikipedia.org/wiki/Posting_style#Top-posting



More information about the Python-list mailing list