From 9ce4ec59f0db4e0531c12310ae354ca6c4b763d7 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 15 May 2024 16:16:54 +0200 Subject: Clean up main loop, ctrl+c or ctrl+d to exit --- kasus.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kasus.py b/kasus.py index 68b0be0..57ebc4a 100644 --- a/kasus.py +++ b/kasus.py @@ -15,10 +15,16 @@ while True: total += 1 print(f"{Style.BRIGHT}--- Übung {total} ---{Style.NORMAL}") print(parameters) + print() print(queryString) print() - response = input("> ") + try: + response = input("> ") + except (KeyboardInterrupt, EOFError): + # TODO print statistics + print("\nBis später!") + break print(f"{Style.BRIGHT}", end="") -- cgit v1.2.3