1def pause(massage = 'press any key to continue'): # this function will pause the script with a default massage or a custome one.
2 print(massage)
3 os.system('pause >NULL') # this will pause untill any key is pressed.
4 return 0
5
6# example usage:
7print('hello') # prints hello.
8pause() # waits untill the user presses a key.
9print('world!') # then prints world!
1# Don't use os.system("pause"), it is very slow because it needs to create
2# an entire shell process. Use this instead:
3
4import getch
5
6def pause():
7 print("Press any key to continue . . . ")
8 getch.getch()