Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to break out of while loop when the user hit ctrl + d python

try:
  while True:
      userInput = input()
      #any other work here
except EOFError as e:
  print(e)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #break #loop #user #hit #ctrl #python
ADD COMMENT
Topic
Name
7+2 =