网站首页 > 博客文章 正文
我们先来了解下如果通过adb 查询设备的CPU温度
1、输入指令
adb shell
cat /sys/class/thermal/thermal_zone0/temp
2、需要注意sheet.write()函数的使用
sheet.write()
wirte(row, col, *args)
向工作表单元格写入普通的数据。
参数:
- row - 单元格所在的行(索引从0开始计数)
- col - 单元格所在的列(索引从0开始计数)
- *args - 传递到子方法的附加参数诸如数字,字符串,单元格格式。
3、开始编写脚本
import os
import xlwt
for i in range(1000):
path = os.popen(r"adb shell cat sys/class/thermal/thermal_zone0/temp").read()
print(path)
f = open(r"C:\Users\Administrator\Desktop\123\2224.txt", "a")
result = str(path)
f.write(result)
f.close()
print("ok")
f1 = open(r"C:\Users\Administrator\Desktop\123\2224.txt")
workbook = xlwt.Workbook()
sheet = workbook.add_sheet('CPU温度', cell_overwrite_ok=True)
sheet.write(0, 0, "CPU温度")
y = 1
while True:
line3 = f1.readline()
if not line3:
break
for i in line3.split(':'):
item = i.strip()
sheet.write(y,0,item)
y += 1
workbook.save(r'C:\Users\Administrator\Desktop\123\4.xls')
猜你喜欢
- 2024-10-24 python处理excel文件03:xlwt模块写入excel文件
- 2024-10-24 经验 | Python 读写 Excel 文件第三方库汇总
- 2024-10-24 python实现爬取豆瓣电影Top250(python爬取豆瓣电影的流程)
- 2024-10-24 Python如何操作Excel,xlrd和xlwt类库的使用
- 2024-10-24 如何用Python读写Excel文件?最便捷的3种方式
- 2024-10-24 安全服务日常工作之大量端口状态扫描
- 2024-10-24 Python操作Excel库xlrd与xlwt常用操作详解
- 2024-10-24 Python读写Excel表格,就是这么简单粗暴又好用
- 2024-10-24 Python学习之爬取网页信息(python爬取网页数据步骤)
- 2024-10-24 pandas + xlwt制作格式化报表遇到的两个问题
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)