Reputation: 172
I want to input more than one line in Python. But when I try to and then I print the result, all it prints is the first line. Is there a way to read also the lines from the input that are below the first line?
For example:
lista=input('Insert the data here: ')
print(' ')
print(lista)
And let's say I want to input:
Hello 1 Jo
By 2 Tom
Really in 4
But it only prints the first line.
Any idea about how to read the other lines in the input so that I can print them afterwards?
Upvotes: 2
Views: 1319
Reputation: 377
If you wanna read 3 line of input. You can do like this.
inputs = [input() for i in range(3)]
inputs
variable will be a list
Upvotes: 3