What are a help () and dir() in python?



What are a help () and dir() in python?..

Answer / Divakaran Kumar

1. Help(): This built-in function is used to get information about functions, classes, modules, or keywords in Python.nnSyntax: `help(function_name)` or `help(module_name)`nnExample: Getting help for the print function: `help(print)`n
2. dir(): This built-in function returns a list of all attributes, functions, and methods associated with an object.nnSyntax: `dir(object)`nnExample: Getting information about a list: `my_list = [1, 2, 3]; dir(my_list)`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Is python pure object oriented programming ?

1 Answers  


Is nan in python pandas?

1 Answers  


What is swapcase() function in the python?

1 Answers  


When to use list vs. tuple vs. dictionary vs. set?

1 Answers  


How to count the occurrences of a list item?

1 Answers  


What does __ init __ py do in python?

1 Answers  


Explain how memcached should not be used in your python project?

1 Answers  


Why is numpy so fast?

1 Answers  


Is html harder than python?

1 Answers  


Tell me what is dict and list comprehensions are?

1 Answers  


How will you get the length of the string?

1 Answers  


Is python used for frontend or backend?

1 Answers  


Categories