input in python

How can we input data in python like that of ideone. like i have input stored in file and i want to give whole input at once through stdin.

1 Like

Check for you answer :

2 Likes

let the file be “fname.txt” and python code be “a.py”. Put them in the same folder. Then use terminal in ubuntuor command prompt in windows to go to the folder where they are and use python a.py < fname.txt. You can also re-direct the output it to another text file by doing python a.py < fname.txt > op.txt

4 Likes

bulldog2.redlands.edu/facultyfolder/…/Tutorial-ReadingWritingData.pdf‎

Try to checkout the this link]

Try the following:

cat input_file.txt | python script.py

i think the link in dead.

url is not correct…