ATOMMAP mint 脚本

import subprocess,random,string,time
import random


def run_cmd(command, keyword):
    """Run a shell command and monitor its stdout and stderr for a keyword."""
    
    # 使用Popen执行命令,并捕获stdout和stderr
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True)
    
    # 持续读取输出直到进程完成
    while True:
        output = process.stdout.readline()
        if output == '' and process.poll() is not None:
            break
        if output:
            print(output.strip())
            if keyword in output:
                print(f"\{keyword}'存在,注册成功啦\n\n\n")
                process.terminate()  # 终止进程
                break

    # 检查stderr,看是否有错误输出
    stderr_output = process.stderr.read().strip()
    if stderr_output:
        print(f"Error: {stderr_output}")
        if keyword in stderr_output:
       

你可能感兴趣的:(python实践web3开发,c++,算法,点云,python)