Python执行Dos命令

2023-01-13 10:16:32
# -*- coding: utf-8 -*-
# 执行dos命令
import os


class DosCmd:
    def excute_cmd_result(self, command):
        result_list = []
        # popen方式
        result = os.popen(command).readlines()
        for i in result:
            if i == '\n':
                continue
            result_list.append(i.strip('\n'))
        return result_list
        
    # os.system的方式
    def excute_cmd(self, command):
        os.system(command)

    def walle(self):
        apk_name = input("输入基础包全称:")
        command = "java -jar walle-cli-all.jar batch2 -f config.json " + str(apk_name) + " Results"
        self.excute_cmd_result(command)
        input("\n\n渠道包已放到Results文件夹下~\n点击任意键退出...")

if __name__ == '__main__':
    dos = DosCmd()
    dos.walle()
  • 作者:多喝水早点睡|
  • 原文链接:https://blog.csdn.net/weixin_43666624/article/details/116064863
    更新时间:2023-01-13 10:16:32