2
A
回答
10
检查是你在这种情况下
>>> def testFunc(arg1, arg2, arg3, additional='test'):
... print arg1
...
>>> import inspect
>>> inspect.getargspec(testFunc)
ArgSpec(args=['arg1', 'arg2', 'arg3', 'additional'], varargs=None, keywords=None, defaults=('test',))
>>>
4
从功能外,你可以使用inspect.getargspec():http://docs.python.org/library/inspect.html#inspect.getargspec
2
朋友看看在inspect.getargspec(func)命令。这给了你一个元组,其中的第一个元素是所需参数的列表。
相关问题
- 1. Mysql的计算函数的参数
- 2. 计算Python中参数的实数
- 3. PHP函数计算传递给函数的参数数量
- 4. Python参数计数
- 5. Sharepoint计算字段函数参考
- 6. Python函数参数
- 7. 使用Python计算CRC zlib.crc32函数
- 8. 使用计算GCD - Python函数返回
- 9. 的Python,sympy计算多变量函数
- 10. Python函数计算会员价
- 11. 计算sigmoid函数
- 12. 函数计算logarit
- 13. 作为函数参数的Python函数?
- 14. 函数中的Python参数
- 15. 函数中的参数python
- 16. Python函数:多个参数
- 17. Python MatPlot栏函数参数
- 18. python:验证函数参数
- 19. Python:函数,传递参数
- 20. 计数函数调用python
- 21. Python C模块函数参数引用计数
- 22. SQL时间参数计算
- 23. 动态计算参数值
- 24. OpenCV的warpPerspective参数计算
- 25. C++:调用基类的构造函数与计算参数
- 26. 如何将参数传递给Knockout中的计算函数?
- 27. C函数计算参数的总大小
- 28. C++调用具有计算参数的超类构造函数
- 29. 的ActionScript:未知参数调用函数计算
- 30. 术语不计算为服用1个参数的函数
可能的重复:http://stackoverflow.com/questions/990016/how-to-find-out-the-arity-of-a-method-in-python,http://stackoverflow.com/questions/ 3913963 /长度的论点-的-蟒功能/ 3915056#3915056 – mouad 2011-01-12 22:52:26