
请尝试以下 *** 作:
import os import subprocess import timeprint ('Current Directory: {}'.format(os.getcwd()) ) print ('Opening Android SDK...') os.chdir('C:\android-sdk\platform-tools') print ('Current Directory: {}'.format(os.getcwd()) )t = str(time.ctime()) try: process_output = subprocess.check_output(["adb", "devices", "-l"])except: #Add here the type of exception you want to raise and logic print("Please check your ADB installation and syntax.")s = ('{} Checking for connected devices: {}'.format(t,process_output) ) with open('logfile.txt', 'w') as f: f.write(s)欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)