I've built a simple cli app using cmd
. I noticed that hitting the enter key seems to be rerunning the previous command. Is there a way to catch/prevent this?
Asked
Active
Viewed 66 times
0

frodo
- 1,561
- 3
- 21
- 36
-
`user_input == ''` or `if not user_input`? – roganjosh Aug 20 '18 at 17:33
-
1sorry, dup of https://stackoverflow.com/questions/16479029/python-cmd-execute-last-command-while-prompt-and-empty-line. going to close. – frodo Aug 20 '18 at 17:37
-
See https://docs.python.org/3/library/cmd.html#cmd.Cmd.emptyline – PM 2Ring Aug 20 '18 at 17:38