import os, platform
def getch():
if platform.system() == "Linux":
os.system("bash -c \"read -n 1\"")
elif platform.system() == "Windows":
import msvcrt
msvcrt.getch()
print("Press key!")
getch()
print("Okay")
Other check for Operating System:
import os
if os.name == "nt":
command = "dir"
else:
command = "ls -l"
os.system(command)