Redirecting stdin and stdout within idle-python3 -


i have python3 program can execute terminal typing:

python3 prog.py < inp_file > out_file 

i execute program within idle shell without change, did not find how tell idle files use.

the idle shell not command line terminal. imitates standard interactive python shell. cannot use terminal-specific syntax either. should able equivalent with

import subprocess subprocess.run('python3 prog.py', stdin=infile, stdout=outfile) 

the files should open files, not file names. read subprocess doc.


Comments

Popular posts from this blog

python - Creating a new column in a dataframe based on the result of the addition of three others -

string - Using python and postgres, variables within execute function? -