【功耗测试环境预置自动化脚本开发】【切换wifi模式为siso模式】【用到方法*args】

import os,re
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='myapp.log',
filemode='a')
cmd1 = r'adb shell*********' #信息安全,恕不能提供全部字段
cmd2 = r'adb shell wl txchain 1'
cmd3 = r'adb shell wl rxchain 1'
args = (cmd1,cmd2,cmd3)
###########################################################
#对args还不是特别的理解,请大神多指点!诚恳希望您能对该脚本提出建设性的改进意见,谢谢!
###########################################################
def changewifi(firstcmd,*args):
s = os.system(firstcmd)
if s ==0:
print('success,going on...')
print(firstcmd)
logging.info(firstcmd)
for lefttuple in args:
os.system(lefttuple)
print(lefttuple)
logging.info(lefttuple)
else:
print('please check if your phone is offline')

cw = changewifi(cmd1,cmd2,cmd3)

猜你喜欢

转载自www.cnblogs.com/Pyguo/p/9085496.html