peiyuan1030 发表于 2017-4-26 10:58:23

python 获得方法的doc

  python多少也学习一点,今天看到有人在CSDN问怎么快速在API找到想要的
,我就自作多情写了一个。。。。。。第一次还给写错了 
,粗心害死人。

# -*- coding: utf-8 -*-
def helpinfo(model,med):
for method in dir(model):
if med is str(method):
if callable(getattr(model,method)):
print "methodName : "+method;
if getattr(model,method).__doc__:
doc = getattr(model,method).__doc__
else:
doc = None;
print "doc : "+ str(doc)
print "\r\n";
helpinfo(str,"zfill")
import sys
helpinfo(sys,"settrace")

  记录下来,也算是一点进步。。。
  PS 很简陋的代码,希望看到的前辈、同志们多多指导。
页: [1]
查看完整版本: python 获得方法的doc