1.代码
import os
adb_dic = {
'1': 'adb devices',
'2': 'adb shell pm list packages',
'3': 'adb shell pm list packages -3',
'4': 'adb shell pm list packages -s',
}
def adb_cmd(k):
adb = adb_dic[k]
os.system(adb)
def adb_run():
while True:
print("""
1.获取连接设备
2.查看应用列表
3.查看第三方应用列表
4.查看系统应用列表
""")
choice = input('请输入序号选择您需要的功能:').strip()
if choice not in adb_dic: continue # 如果输入的不在里面,返回循环
adb_cmd(choice) # 加括号就可执行
def run():
while True:
print("""
1.adb命令
2.其他1
""")
choice = input('请选择:').strip()
if choice == '1':
adb_run()
else:
print('输入的指令有误')
if __name__ == '__main__': #
run() # 程序启动
标签:__,run,Python,choice,命令,adb,print,pm