Reputation: 43
I am working on Automation part.I am running adb command via os.system("adb devices") in python.
I want to save output of command "adb devices" in variable because I want to compare device id which ever I am getting from adb devices and fastboot devices.
Upvotes: 0
Views: 1960
Reputation: 69328
You can also use AdbClient
from AndroidViewClient/culebra
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from com.dtmilano.android.adb.adbclient import AdbClient
for device in AdbClient().getDevices():
print device
to list all devices and its properties, like serialno.
Upvotes: 2
Reputation: 1179
process = subprocess.Popen(cmd, shell=True,stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, ''):
print line
Compare line with your value
Upvotes: 0