+ 1

Why this doesn't raise EOFError?

I wrote this based on pitmob code on the challenge, for taking multiple lines of entry. Problem is, Empty input doesn't raise any exceptions, and the while loop never breaks. while True: try: print(input().title()) except EOFError: break Any suggestions? https://code.sololearn.com/ci07b842jrU0/?ref=app

28th Nov 2017, 8:57 AM
Sina Seirafi
Sina Seirafi - avatar
3 Réponses
+ 2
use this while True: try: a=input () if a: print a.title() else: break except: break
28th Nov 2017, 9:09 AM
Pavan Kumar T S
Pavan Kumar T S - avatar
+ 2
Unfortunately, this one faces EOFError, the last time it tries to get the input.
28th Nov 2017, 9:53 AM
Sina Seirafi
Sina Seirafi - avatar
0
check edited answer
28th Nov 2017, 9:58 AM
Pavan Kumar T S
Pavan Kumar T S - avatar