1

Would you please say me how can I convert this code:

path to app/adb devices | awk 'NR>1{print $1}' | xargs -n1 -I% adb -s % install app.apk

to python command?

Red
  • 26,798
  • 7
  • 36
  • 58
ermi
  • 81
  • 1
  • 11
  • Does this answer your question? [How to execute a program or call a system command from Python](https://stackoverflow.com/questions/89228/how-to-execute-a-program-or-call-a-system-command-from-python) – fsl Mar 07 '21 at 13:02
  • 1
    Not really .... – ermi Mar 08 '21 at 09:42
  • The second answer in the link I suggested is precisely the same as the answer below... – fsl Mar 08 '21 at 10:20

1 Answers1

1

You can always utilize the os.system() method:

import os

command = "path to app/adb devices | awk 'NR>1{print $1}' | xargs -n1 -I% adb -s % install app.apk"

os.system(command)
Red
  • 26,798
  • 7
  • 36
  • 58