python - 如何为 jupyter 编写 argparse
问题描述
如何argparse
在 jupyter notebook 中编写此代码?
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to input image")
ap.add_argument("-y", "--yolo", required=True,
help="base path to YOLO directory")
ap.add_argument("-c", "--confidence", type=float, default=0.5,
help="minimum probability to filter weak detections")
ap.add_argument("-t", "--threshold", type=float, default=0.3,
help="threshold when applying non-maxima suppression")
args = vars(ap.parse_args())
解决方案
为了从命令行执行您的 jupyter notebook 并传递参数,您可以使用 papermill 之类的工具 下面的 github 链接包含有关如何使用它的详细文档
推荐阅读
- ios - CURL 推断对 HTTP 标头的请求?
- android-studio - Youtube 播放器视图不显示使用 youtube API 和频道导入的视频
- google-kubernetes-engine - 无法使用 kustomize 修补服务名称
- java - firebase android有没有办法在一个范围内获取数据?
- bash - 在 shell 脚本中循环 json 输出
- function - 在 JavaScript 或 Python 中使用检查函数自动猜测数字的函数最多 50 次
- reactjs - 我如何将用户特征(姓名、部门等)添加到我的 const 变量中以做出反应?
- javascript - React js TypeError:无法读取未定义的属性'id'
- java - 如何将 PrettyPrintingJsonGeneratorDecorator 和 MaskingJsonGeneratorDecorator 结合在一起?
- javascript - react-native native ui组件android中具有自定义名称的事件