我有以下代码,但是在回调之外运行from pynput import keyboard
import time
def on_press(key):
print('{} pressed.'.format(key))
def on_release(key):
print('{} released.'.format(key))
if str(key) == 'Key.esc':
print('Exiting...')
return False
listener=keyboard.Listener(on_press = on_press,on_release = on_release)
listener.start()
listener.join()
会导致数组为空。如何在回调之外获取填充的数组?
console.log(points)