Multiple Lines Input Python

multiline input in python
print("Enter the array:\n")
userInput = input().splitlines()
print(userInput)
multiline input in python
import sys
userInput = sys.stdin.readlines()
multiple line input python
lines = []
while True:
line = input()
if line:
lines.append(line)
else:
break
text = '\n'.join(lines)
multiple lines input python
print("Enter/Paste your content. Ctrl-D or Ctrl-Z ( windows ) to save it.")
contents = []
while True:
try:
line = input()
except EOFError:
break
contents.append(line)

Leave a Comment