2016-11-25 9 views
-1

私は、オートメーションパートで作業しています。私は、pythonでos.system( "adb devices")経由でadbコマンドを実行しています。コマンドの結果を「adb devices」変数に保存する

コマンド "adb devices"の出力を変数に保存したいのは、私がadbデバイスやfastbootデバイスから取得したデバイスIDを比較したいからです。

+0

[Python:os.systemを実行した後にstdoutを取得する方法](http://stackoverflow.com/questions/18739239/python-how-to-get-stdout-after-running-os-system)の可能な複製) –

答えて

0
process = subprocess.Popen(cmd, shell=True,stdout=subprocess.PIPE) 
for line in iter(process.stdout.readline, ''): 
    print line 

があなたの価値を持つライン

0

の比較またのSerialNoのように、すべてのデバイスとそのプロパティを一覧表示するAdbClient

#! /usr/bin/env python 
# -*- coding: utf-8 -*- 

from com.dtmilano.android.adb.adbclient import AdbClient 

for device in AdbClient().getDevices(): 
    print device 

AndroidViewClient/culebraからを使用することができます。

+0

これは、現在のコンテキストでより意味をなさないでしょう! :) – Waman

関連する問題