我有一个带有文档字符串的Python脚本。当命令行参数的解析不成功时,我想打印用户信息的文档字符串。
有没有办法做到这一点?
最小示例
#!/usr/bin/env python
"""
Usage: script.py
This describes the script.
"""
import sys
if len(sys.argv) < 2:
print("<here comes the docstring>")
https://stackoverflow.com/questions/7791574
复制相似问题