Sometimes, we want to make a Python script wait for a pressed key.
In this article, we’ll look at how to make a Python script wait for a pressed key.
How to make a Python script wait for a pressed key?
To make a Python script wait for a pressed key, we can use the input
function.
For instance, we write
input("Press Enter to continue...")
to call input
with the prompt text to wait for the user to press enter before continuing the script.
Conclusion
To make a Python script wait for a pressed key, we can use the input
function.