在windows上比较简单:

import  msvcrt
ch = msvcrt.getch()

其他平台,可以安装getch模块

pip install getch

然后

import getch
# ...
char = getch.getch() # User input, but not displayed on the screen
# or
char = getch.getche() # also displayed on the screen

标签: none 阅读量: 2496

添加新评论