utils.py 文件源码

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

项目:ripe-atlas-monitor 作者: pierky 项目源码 文件源码
def edit_file(file_path, ask=None):
    # return True if user tries to edit the file
    if ask:
        try:
            answer = input(ask)
        except KeyboardInterrupt:
            return False

        if answer.lower() != "yes":
            return False

    editor = os.environ.get("EDITOR", Config.get("misc.editor"))

    res = os.system("{} {}".format(editor, file_path))

    if res != 0:
        print("Error executing the default editor ({})".format(editor))

    return res == 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号