python 查看某个模块都有什么方法

 

1.看官方文档 https://docs.python.org/3/search.html?q=os&check_keywords=yes&area=default

2.看源码

3.dir()

import requests,os,random
print(dir(random))

# ['BPF', 'LOG4', 'NV_MAGICCONST', 'RECIP_BPF', 'Random', 'SG_MAGICCONST', 'SystemRandom', 
# 'TWOPI', '_BuiltinMethodType', '_MethodType', '_Sequence', '_Set', '__all__', '__builtins__', 
# '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_acos', 
# '_ceil', '_cos', '_e', '_exp', '_inst', '_log', '_pi', '_random', '_sha512', '_sin', '_sqrt', '_test',
# '_test_generator', '_urandom', '_warn', 'betavariate', 'choice', 'expovariate', 'gammavariate', 'gauss', 
# 'getrandbits', 'getstate', 'lognormvariate', 'normalvariate', 'paretovariate', 'randint', 'random', 'randrange', 
# 'sample', 'seed', 'setstate', 'shuffle', 'triangular', 'uniform', 'vonmisesvariate', 'weibullvariate']

 

posted @ 2019-06-30 23:41  anobscureretreat  阅读(1874)  评论(0编辑  收藏  举报