""" This is a python program ,name:apihelper.py python object info: copy from dive into python write my self. just a test ----ymirjoe@2016-3-28. """ def info (object,spacing=20, collapse = 1): """ Show detail of Module,dictionary,class,list,tuple etc. Usage: 1 , Import this python program:apihelper.py >>>import apihelper 2 , info(object) >>>info(str) 3 , other parameters like the function define: >>>info (object,spacing=20, collapse = 1) 4 , You can use python help document like: >>>help(apihelper)"""
methodList=[e for e in dir(object) if callable (getattr(object,e))] processFunc = collapse and (lambda s: " ".join(s.split())) or (lambda s: s) print("\n\n".join(["%s %s" % (method.ljust(spacing), processFunc(str(getattr(object,method).__doc__))) for method in methodList])) print(info.__doc__) if __name__ == "__main__": pass Python免费学习资源加扣扣1954532972验证备注py获取
|