Python小知识 发表于 2020-10-12 更新于 2020-10-21 分类于 Python , Tips 1. 获取指定方法的参数信息123456789def user_add(username, password, **kwargs): print('username:', username, ', password:', password)argspec = inspect.getfullargspec(user_add)print(argspec)#output: FullArgSpec(args=['username', 'password'], varargs=None, varkw='kwargs', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})print(argspec[0])#output: ['username', 'password']