msgfy是一个python库,用于将异常实例转换为人类可读的错误消息。
msgf的Python项目详细描述
msgfy
Usage
Convert from Exception instance to an error message
Sample Code: | ^{pr 1}$ |
---|---|
Output: | ^{pr 2}$ |
Specify message format
Sample Code: | ^{pr 3}$ |
---|---|
Output: | ^{pr 4}$ |
Convert from Exception instance to a debug message
Sample Code: | ^{pr 5}$ |
---|---|
Output: | ^{pr 6}$ |
消息格式的可用关键字
Keyword | Replaced to |
---|---|
^{tt1}$ | Exception class name |
^{tt2}$ | File name that exception raised |
^{tt3}$ | Line number where the exception raised |
^{tt4}$ | Function name that exception raised |
^{tt5}$ | Message that passed to the exception instance |
Installation
Install from PyPI
pip install msgfy
Install from PPA (for Ubuntu)
sudo add-apt-repository ppa:thombashi/ppa sudo apt update sudo apt install python3-msgfy