-
工具描述
在进行一项时间非常长的测试时,需要对程序、任务管理器状态等进行监控,由此需要一个定时截屏的功能
-
代码
from PIL import ImageGrab
import time
count = 0
while True:
count += 1
pic = ImageGrab.grab()
name = time.strftime("%Y-%m-%d---%H:%M:%S", time.localtime()).replace(':', '-')
pic.save(r'E:\img\%s.jpg' % name)
print(count)
time.sleep(60)
注意,需要安装pillow库