Key.command 不行,用Key.cmd 。
win或linux下:
python
with keyboard.pressed(Key.ctrl):
keyboard.press('a')
time.sleep(1)
keyboard.release('a')
那么在mac下就是:
python
with keyboard.pressed(Key.cmd):
keyboard.press('a')
time.sleep(1)
keyboard.release('a')
因为mac下全选按钮是command + A