Python (packages)

I have a question
How do I know that, for example, what are the functions in the requests library in Python?
And what do those functions do?

Documentation of module/library. Or in repl/interactive console dir and help functions to find attributes/functions of module/library and what they do.

For example:

>>> import math
>>> dir(math)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc']
>>> help(math.pow)
Help on built-in function pow in module math:

pow(x, y, /)
    Return x**y (x to the power of y).

Apart from the in-python options sanity showed, you can also go to the official site of the libraries and read their documentations.
For example, if you wanna know what scikit-learn or pygame can do. And then you might want to watch out for tutorials on there, youtube or whatnot, because some libraries can cover massive amounts of stuff.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.