Thank you for your helping. I could solve my probem myself as following these steps.
import mscvrt while True: key=mscvrt.getch().decode('utf-8) if key=='1' print('System is active.') elif key=='0' print('System is inactive.')