当前位置:主页 > 软件编程 > Python代码 >

Linux上使用Python统计每天的键盘输入次数

时间:2021-05-24 08:48:59 | 栏目:Python代码 | 点击:

Github 项目主页 工具源码

分析结果:

total : 15981 1568.0 == Backspace 1103.0 == Tab 1038.0 == Enter 900.0 == Space 765.0 == L_Alt 730.0 == L_Control 700.0 == S 689.0 == L_Shift 544.0 == I 500.0 == A 494.0 == E 410.0 == N

最后的统计结果,: 删除,Enter 空格 使用最多

Web Redis 此项目将redis中的数据使用 echarts 做了可视化

Python的evdev模块

官方文档

此项目基于该模块实现的

# 简易Demo: 实现对键盘敲击次数的计数
from evdev import InputDevice
from select import select
def detectInputKey(count):
 dev = InputDevice('/dev/input/event0')
 while True:
  select([dev], [], [])
  for event in dev.read():
   if event.value == 1 and event.code != 0:
    count+=1
    print(count)

detectInputKey(0)

注意要root权限执行.

其他可选择的基础工具

总结

您可能感兴趣的文章:

相关文章