adb shell getevent 获取手机0035 0036坐标并打印到文件

linux 下:

adb shell getevent | grep "0035\|0036" > info.txt

windows下:

adb shell getevent | findstr "0035 0036" > info.txt

python读取坐标:

x_dict = {}
y_dict = {}

with open("info.txt", "r") as f:
    lines= f.readlines():
    for line in lines:
        if "0035" in line:
            x_dict[x] = line.split(" ")[-1]  #字典中key具有不可重复性,借此取得最新的x值
        
        if "0036" in line:
            y_dict[y] = line.split(" ")[-1]  #同上

x = x_dict[x]
y = y_dict[y]

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值