def on_key_press(event): s=str(event.name) print(s) value = get_value(s) print(value)

def get_value(s): dictionary = {'1': '02', 'q': '10', 'a': '1e', ';': '27', 'z': '5a', 'enter': '0e'} if s in dictionary: return dictionary[s] else: return None

keyboard.on_press(on_key_press) keyboard.wait('esc') keyboard.unhook_all()


原文地址: http://www.cveoy.top/t/topic/iSLc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录