[英]How can I read text from a specific window?
只是解析最新的日志文件...我不知道您為什么要嘗試解析某些窗口內容...
就像是
import os
fpath = os.path.expandvars(r"%appdata%\.minecraft\logs\latest.log")
with open(fpath) as f:
f.seek(-1) # jump to end
while True:
line = f.readline()
if not line:# no new text
# might want to add a bit of a sleep
continue
print("Log Line:",line)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.