- # python-U1
- import uiautomator——from uiautomator import ——d=Device(“SN”)——d.info
- # python-U2
- import uiautomatro2 as u2——d = u2.connect("IP/SN")——d.info
- # 打开uiautomator2—weditor
- python –m uiautomator2 init / python –m weditor
- # 打开weditor若出现 error : python –m weditor 删掉uiautomator.apk,重新进行命令输入
- # 连接电脑查看手机之间连接ip
- adb shell > ifconfig p2p0
- # 连接电脑查看手机连接无线ip
- adb shell > ifconfig wlan0
- # 强制删除某文件
- adb shell > rm –rf <文件名>
- # Linux查看java版本
- update-alternatives –config java
- # Linux更新电脑证书
- sudo update-ca-certificates –f
- # python2 python 3 兼容(pip2 list / pip3 list)
- py -2 –m pip list / py -3 –m pip list
- # 创建/删除qq文件夹
- mkdir qq / rmdir qq
- # adb查看设备fingerprint信息
- adb shell getprop | grep fingerprint
- # 在android studio底部的Terminal窗口中输入: netstat -aon|findstr 5037 如下图,会列出哪些进程占用了这个端口 1指向的是输入命令,2指向的是搜索结果,表示有这些进程占用了这个端口
- netstat -aon|findstr 5037
- # 查询在用的端口
- netstat –ant
- # python获取系统时间
- ①#!/usr/bin/python
- import time
- print time.asctime( time.localtime(time.time()) )
- ②print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
- ③print "%s" % time.ctime()
- ④from datetime import datetime
- print datetime.now()
- print datetime.utcnow()
- 输出结果:
- ①Wed Dec 12 09:23:02 2018
- ②2018-12-12 09:23:27
- ③Wed Dec 12 09:23:40 2018
- ④2018-12-12 09:24:10.106502
- 2018-12-12 01:24:34.444605
- # python输出时间戳
- import time
- import datetime
- t = time.time()
- print (t) #原始时间数据
- print (int(t)) #秒级时间戳
- print (int(round(t * 1000))) #毫秒级时间戳
- 输出结果:
- 1499825149.26
- 1499825149
- 1499825149257