stitch_utils.py 文件源码

python
阅读 40 收藏 0 点赞 0 评论 0

项目:Stitch 作者: nathanlopez 项目源码 文件源码
def st_logger(resp,log_path,log_name,verbose=True):
    if no_error(resp):
        i = 1
        log = os.path.join(log_path,'{}.log'.format(log_name))
        while os.path.exists(log):
            new_log_name = '{} ({}).log'.format(log_name,i)
            log = os.path.join(log_path,new_log_name)
            i += 1
        if verbose: st_print("[+] Output has been written to {}\n".format(log))
        with open(log,'w') as l:
            l.write(resp)

#http://stackoverflow.com/questions/2828953/silence-the-stdout-of-a-function-in-python-without-trashing-sys-stdout-and-resto
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号