1. #!/usr/bin/python
    2. # -*- coding: utf-8 -*-
    3. import math
    4. import random
    5. # 返回一个math的方法列表
    6. print(dir(math))
    7. # 结果:['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc']
    8. # 查看math的文档注释
    9. help(math)
    10. # 结果:
    11. # Help on built-in module math:
    12. #
    13. # NAME
    14. # math
    15. #
    16. # DESCRIPTION
    17. # This module is always available. It provides access to the
    18. # mathematical functions defined by the C standard.
    19. #
    20. # FUNCTIONS
    21. # acos(...)
    22. # acos(x)
    23. #
    24. # Return the arc cosine (measured in radians) of x.
    25. #
    26. # acosh(...)
    27. # acosh(x)
    28. #
    29. # Return the inverse hyperbolic cosine of x.
    30. # 打印random模块的文件路径
    31. print(random.__file__)
    32. # 结果:E:\python\lib\random.py