cli.py 文件源码

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

项目:csvtotable 作者: vividvilla 项目源码 文件源码
def prompt_overwrite(file_name):
    # Skip if file doesn't exist
    if not os.path.exists(file_name):
        return True

    # Prompt for file overwrite if outfile already exists
    fmt = "File ({}) already exists. Do you want to overwrite? (y/n): "
    message = fmt.format(file_name)

    click.secho(message, nl=False, fg="red")
    choice = click.getchar()
    click.echo()

    if choice not in ("y", "Y"):
        return False

    return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号