Getting the adb output using Python

前端 未结 3 907
夕颜
夕颜 2021-01-20 20:25

I\'m trying to get the output of a adb command using the following code:

pathCmd = \'./adb shell pm path \' + packageName


pathData = subprocess.Popen(pathC         


        
3条回答
  •  面向向阳花
    2021-01-20 20:59

    from subprocess import Popen, PIPE
    
    with Popen(['adb devices'], shell=True,stdout=PIPE) as proc:
        for val in proc.stdout.readlines()[1:-1]:
            print(val.decode('UTF-8').replace('device', '').strip())
    

提交回复
热议问题