how can we know which function is in which module so that we can use it . please help?
Hi Lakshay,
If I got your question correctly, you are looking for a function name from modules.
There are two basic types of function in python:
- Built-In Functions: Part of python language
- User-Defined Function: Created by the user using the “def” keyword
Note:
-
To List All Built-In functions in python:
for ele in __builtins__.__dict__: print(ele)
You may refer list here as well: https://www.w3schools.com/python/python_ref_functions.asp
-
To get the function name from a imported module:
a) Get the docs on all the functions: $ help(module_name) b) List the names of all the functions and variables: $ dir(module_name)
Hope it helps!
thanks for your response…
but how can i know as like os module we have so how many functions it has or whats its user how can i get that as there are many other modules we have so how can i import or use them?
that’s my question is? please help
to know about how many or what functions are there in a module, there are two options ,
- For most of the great modules like numpy , pandas , os there must be a documentation or github repo you can go throught that online , just search for the function online and you will get a site like doc.python.org
- Simply import your module/ package in Jupyter Notebook and type the following command …
help(package_name/function_name)
Using the help command you can get the documentation of most of the functions or packages , but sometimes it is not clearly written so you might have to surf the net, other than that help command is pretty awesome.
here is an example of what I said
Hope I was of help , Thank You.