0

Im lookting to see if its possible to print text with the press of a button, For example

Print("Text Here") if Press (key)

Im using this to make the introduction to my program more interactive. Thank you

  • 2
    Does this answer your question? [detect key press in python?](https://stackoverflow.com/questions/24072790/detect-key-press-in-python) – Brian61354270 Jun 23 '20 at 01:10

1 Answers1

0

Yes, by using the OS module.

Windows:

import os
os.system('pause>nul')
print("Hello")

Bash, (Linux):

import os
os.system('read -n1 -r -p Press any key to continue')
print("Hi")