What is the best way in Python 3 to read in multi-line user input when the amount of input is unknown? The multi-line input will be separated by Enter
when I try using
while True:
line = input()
if line:
print(line)
else:
break
I receive an EOFError
Then if I change it to a try-catch block
while True:
line = input()
try:
print(line)
except EOFError:
break
I still get the EOFError.
input()
. So that should be in thetry
. – Artemasinput
but I suppose it's possible. – KoaCtrl+D
in most terminals, this is also seen as termining the stdin. – Artemas