1

I'm coding something but I want that when the user hit any key (or a specific key if it is better) to 'stop' the program until the user want to restart it... I searched on the web and found the os.system('pause'); it's exactly what I want, but I'm under mac os, and the function is only working on the windows os module. I don't want the user hit 'enter' after hit a key (like input('text') function); I want the user just have to hit one key... Is it possible on mac os?

Thanks in advance for answering !

Dacapo
  • 17
  • 6
  • Does this answer your question? [How to read a single character from the user?](https://stackoverflow.com/questions/510357/how-to-read-a-single-character-from-the-user) – MisterMiyagi Oct 28 '20 at 18:18
  • `read -n1 -r` does this on Linux. Not sure if it is available on Mac, though – Marat Oct 28 '20 at 18:24
  • @Marat ``read`` is a shell builtin of ``sh``, so it is at the very least available on Mac via ``/bin/sh``. – MisterMiyagi Oct 28 '20 at 18:32

0 Answers0