How do I stop the program until I get input?

Asked 2 years ago, Updated 2 years ago, 139 views

Press any key to exit...

You want to paste a code that ends after you receive a keyboard input (whatever) at the end of the program.

In C, we could have gotten a character type through scanf If I use input(), I have to type in enter. Is there any other way?

input ("Press any key to exit...") #Exit only when you press Enter

python wait keyboard-input

2022-09-21 15:32

1 Answers

The msvcrt module allows you to write visual C/C++ runtime library functions.

import msvcrt as m
def wait():
    m.getch()

There are no standard libraries available separately on Linux, etc.

There is.


2022-09-21 15:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.