debug.py 文件源码

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

项目:ingest-client 作者: jhuapl-boss 项目源码 文件源码
def get_confirmation(prompt):
    """Method to confirm decisions

    Args:
        prompt(str): Question to ask the user

    Returns:
        (bool): True indicating yes, False indicating no
    """
    decision = False
    while True:
        confirm = input("{} (y/n): ".format(prompt))
        if confirm.lower() == "y":
            decision = True
            break
        elif confirm.lower() == "n":
            decision = False
            break
        else:
            print("Enter 'y' or 'n' for 'yes' or 'no'")

    return decision
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号