#!/usr/bin/python
#_*_encoding:UTF-8_*_
import os
import time
import sys
#reload(sys)
#sys.setdefaultencoding('utf-8')
path = "D:/机器人协助测试内容/WiFi联网环境配置/机器人安装的工具".decode('utf-8').encode('gb2312')
#路径的斜杠应该是反斜杠,路径字符串应该做编解码处理
files = os.listdir(path)
for ff in files:
#print "adb install -r "+ff
command = 'adb install -r "{}"'.format(os.path.join(path, ff) )
print command
text =os.system(command)
time.sleep(2)
print text;
for fff in files:
text2='adb install -r "'+path+'/'+fff+'"'
print text2
text1 = os.system(text2)
'''
os.system接口接受字符串,'adb install -r "'+path+'/'+fff+'"'整体作为字符串放入,
"'+path+'/'+fff+'"作为一个字符串整体放在命令后能够解决apk名字空格不识别的问题
'''
time.sleep(2)
print text1;
网友评论