sys库
常用参数
SUM
getopt库
代码示例**待完成
import getopt,sys
try:
opts,args = getopt.getopt(sys.argv[1:],"hi:v",["distpath=","clean"])
for o,a in opts:
if o == "h":
print("发现h新参数")
elif o == "-v":
print("发现-v新参数")
elif o == "-i":
print("发现-i参数及其对应值{}".format(a))
elif o == "--distpath":
print("发现--distpath参数及其对应值{}".format(a))
elif o == "--clean":
print("发现--clean新参数")
else:
print("发现未知参数")
except getopt.GetoptError:
print("命令行解析错误")
sys.exit(2)
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
命令行解析错误
Traceback (most recent call last):
File “
opts,args = getopt.getopt(sys.argv[1:],”hi:v”,[“distpath=”,”clean”])
File “D:\SoftWares\ImageProcess\Anaconda3\envs\pytorch\lib\getopt.py”,
…….