+ 4

Import module

How to get a description of functions from an imported module? For example, to work with a hash, you specified "import hashlib" for me, but how do I know what functions this module contains and what they return ?

14th Oct 2019, 7:32 PM
Ivan Ivanov
Ivan Ivanov - avatar
10 Answers
+ 4
Try import <module_name> print(dir(<module_name>))
14th Oct 2019, 7:43 PM
Russ
Russ - avatar
+ 3
run: help("<module name>.<function name>")
14th Oct 2019, 7:36 PM
Seb TheS
Seb TheS - avatar
+ 3
So help("hashlib.sha1")is good result . Seb TheS was right, but i didn,t know any function and i got misstake. Russ gave me the way for it. Thank you Seb TheS and Russ:))
14th Oct 2019, 7:59 PM
Ivan Ivanov
Ivan Ivanov - avatar
+ 3
You can use the original python docs: (including samples) https://docs.python.org/3.7/library/hashlib.html
14th Oct 2019, 8:52 PM
Lothar
Lothar - avatar
+ 1
Seb TheS, But how to get a complete list of module functions?
14th Oct 2019, 7:37 PM
Ivan Ivanov
Ivan Ivanov - avatar
+ 1
Russ, great:))
14th Oct 2019, 7:47 PM
Ivan Ivanov
Ivan Ivanov - avatar
+ 1
Ivan Ivanov It should not give errors unless if you typed it with < and > s.
14th Oct 2019, 7:48 PM
Seb TheS
Seb TheS - avatar
+ 1
Seb TheS, 1.import hashlib print(dir(hashlib)) Result the best 2. help("hashlib") Result errors .many many errors
14th Oct 2019, 7:52 PM
Ivan Ivanov
Ivan Ivanov - avatar
+ 1
Try leaving out the "s help(hashlib)
14th Oct 2019, 7:55 PM
Russ
Russ - avatar
- 1
How i can improve in coding? Like pyhton Now i am student in university and i start Computer science field in August 2019
16th Oct 2019, 7:28 PM
Yaser Saee
Yaser Saee - avatar