Pythonを介してADBコマンドを実行していますが、ある程度は正常に機能します。コードは:
#!/usr/bin/python
import sys
import string
import os
import subprocess
cmd = 'adb shell ls'
s = subprocess.Popen(cmd.split())
print "Again"
t = str(s)
for me in t.split('\n') :
print "Something"
print me[1]
私が得る出力は次のとおりです:
static-243:Scripts adityagupta$ ./hellome.py
Again
Something
s
static-243:Scripts adityagupta$ config
cache
sdcard
acct
mnt
vendor
d
etc
ueventd.rc
ueventd.goldfish.rc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
私がそれぞれをリストにして、その中に各要素を保存することができるどんな提案でも。リストは次のようになります
list = [cache、sdcard、acct、mnt、vendor..]など。