Home > front end >  Manually reading multiple lines of input in terminal
Manually reading multiple lines of input in terminal

Time:02-05

I am writing a python code for a class which needs multiple lines of inputs.

For example I need the input to be in the format:

3 14
12 10
12 5
10 5

When entering this manually on the terminal, I do not know how to signal an end of input.

I have been working around it by entering the inputs in txt files and reading these.

CodePudding user response:

On Linux, use Ctrl D to type "end of file". On Windows, use Ctrl Z.

CodePudding user response:

Besides the control-d, in bash, you can also:

pythonscript <<EOF
3 14
12 10
12 5
10 5
EOF
  • Related