【问题标题】:Command line prints should be saved in .txt file every 10min with multiple trail's命令行打印应每 10 分钟保存在 .txt 文件中,并带有多个跟踪
【发布时间】:2020-04-15 08:27:23
【问题描述】:

导入操作系统 进口时间

当真时: os.system("速度测试.exe") Time.sleep(1000)

【问题讨论】:

    标签: python-3.x networking automation automated-tests pytest


    【解决方案1】:

    试试这个

    import os 
    import time
    
    index = 0
    while True: 
        os.system(f"speed test.exe > speed_text_{index}.txt") 
        index+=1
        time.sleep(1000)
    

    【讨论】:

    • 如果我尝试这个,它将覆盖以前的 .txt 文件。我的意思是我想每 10 分钟保存一次新的文本文件,如下所示。 speed_text1.txt 10mits speed_text2.txt 所以......循环继续
    • 它工作正常,但输出结果为.txt文件没有保存完整的MN
    猜你喜欢
    • 2017-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    • 1970-01-01
    • 2014-01-07
    相关资源
    最近更新 更多