【问题标题】:Writing in a file while reading the keybord with pynput not working在使用 pynput 读取键盘时写入文件时不起作用
【发布时间】:2022-12-02 17:15:05
【问题描述】:
from pynput.keyboard import Key, Listener
lol = open(\"GOTEM.txt\",\'a\')

def on_press(key):
    lol.write(\'{0}\'.format(key)) 
with Listener(on_press=on_press) as listener:
    listener.join()
lol.close()

100% a code problem because I tried writing into a file without the whole keybord thing and it works just fine.I am new to coding so ik I made some stupid mistake.

    标签: python file pynput


    【解决方案1】:
    猜你喜欢
    • 2020-04-28
    • 1970-01-01
    • 1970-01-01
    • 2011-10-16
    • 2020-02-17
    • 1970-01-01
    • 2020-09-23
    • 2019-04-18
    • 2014-07-26
    相关资源
    最近更新 更多