标签:def list 获取 strip() spl import lis popen RoCE
# -*- coding: utf-8 -*- import subprocess import os cmd = ‘adb devices‘ #此处亦可用"adb get-serialno",弊端是只能获得一台手机的序列号 pi= os.popen(cmd) #if pi.read().strip() == ‘List of devices attached‘: # print(pi.read().strip()) # print(pi.read().strip()) def get_Defa_dev(): tmp = [] for i in pi: if i.strip() == ‘List of devices attached‘: pass elif i != ‘‘ and i !=‘\n‘ : i = i.split(‘\t‘,1) tmp.append(i[0]) return tmp[0] a = get_Defa_dev() print(a)
标签:def list 获取 strip() spl import lis popen RoCE
原文地址:https://www.cnblogs.com/wzerowx/p/11134604.html