python 获取手机设备号

上代码
 1 ##获取设备多台设备号列表
 2 def get_deviceid():
 3     str_init=' '
 4     all_info= os.popen('adb devices').readlines()
 5     print('adb devices 输出的内容是:',all_info)
 6 
 7     for i in range(len(all_info)):
 8         str_init+=all_info[i]
 9     devices_name=re.findall('
(.+?)	',str_init,re.S)
10 
11     print('所有设备名称:
',devices_name)
12     return devices_name
13 
14 r=get_deviceid()
15 print(r)



原文地址:https://www.cnblogs.com/lisa2016/p/11209106.html