我正在尝试制作一个python脚本,通过adb检查数据库的内容。问题是在我的代码中,只有第一个subprocess.call执行()并忽略其余部分。由于我对Python相当陌生,我不确定如何修复它。代码如下:
import subprocess
def root():
subprocess.call('adb shell',shell=True)
x=input('Enter package name: ')
openSql(x)
def openSql(x):
subprocess.call('cd data/data/%s/databases/'%(x),shell=True)
table=input('Enter table name: ')
openTable(table)
def openTable(table):
subprocess.call('sqlite3 table',shell=True)
subprocess.call('select * from %s'%(table),shell=True)
root()
它没有给出任何错误,但它只是在我的仿真器中输入根目录,其他什么都没有。在
^{pr2}$
调用
root
函数root()
,这会将您放入adb shell。您试图从adbshell运行一个python
命令input
,但该命令不起作用。在有几个链接可以帮助您完成您想要的操作:
runpythonfromshell
sl4a
相关问题 更多 >
编程相关推荐