Suppose the sample input is this:
"1 2 3" "hello" "hi there" "x y z" "5 6 7"
This should be passed into stdin and the output should simply print them to stdout
I have the following code in sample.py, and I'm using Eclipse as my IDE.
import fileinput for line in fileinput.input(): print line
If I'm using a command line, I might be able to do something like
python sample.py "1 2 3 \n hello"
to pass the input to stdin. But how should I do this on Eclipse(when there are multiple lines that should be inputted into stdin)?
Since I didn't know how to do this, I simply put the lines into a txt file and read from it.