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

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -