title: How to exit a program if a blank line is entered?
body: <p>I just want to exit the program if a blank line is entered. What do I need?</p>
  
  <p>I've tried sys.exit(), but that doesn't quit the program, just returns a blank</p>
  
  <pre><code>while True: # Ask for patient ID
          try:
              i = int(input("Enter patient ID (or blank to exit): "))
              if not i:
                  sys.exit()
              else:
                  a = len(str(abs(i))) # Checking valid integer
                  if a != 6: # Checking id is six digits
                      print("Enter valid patient ID (six digit positive integer)")
                  else:
                      break
          except ValueError:
              print("Enter valid patient ID (six digit positive integer)")
  </code></pre>
  
  <p>I just expect the program to quit.</p>