跳转到主要内容

一个模块,用于通过“did you mean”建议来改进“找不到文件/命令”错误消息。

项目描述

PyDidYouMean

一个模块,用于通过“did you mean”建议来改进“找不到文件/命令”错误消息。

安装方式

pip install pydidyoumean

典型用法

if FILE_NOT_FOUND:
  pydidyoumean.printFileSuggestion(FILENAME) # if no suggested file is found in the cwd, this prints nothing
  # prints out "Did you mean %s?\n" % (SUGGESTED_FILENAME)

if COMMAND_NOT_FOUND:
  pydidyoumean.printSuggestion(CMD_NAME, LIST_OF_ALL_CMDS) # if no suggested command is found, this prints nothing
  # prints out "Did you mean %s?\n" % (SUGGESTED_CMD)

还有一些其他功能和可选参数,用于自定义消息或获取建议。文档在https://pydidyoumean.readthedocs.org

由以下支持