Last active
March 10, 2022 21:42
-
-
Save byung-u/957f2094438b06283810ff0985e545d3 to your computer and use it in GitHub Desktop.
Exit while loop by user hitting enter key (python)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# http://stackoverflow.com/questions/7255463/exit-while-loop-by-user-hitting-enter-key | |
while True: | |
i = input("Enter text (or Enter to quit): ") | |
if not i: | |
print("excape") # Enter key to quit | |
break | |
print("Your input:", i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good hint, thanks :)