Task Description:
1 using Python code to implement the document description of object objects, in addition to using Help;
2 Practice using Strings, object default methods, and so on
3 Display in selectable format
Program Description
ImportRequests" "gets the object's calling function and the doc document's information object: objects that need to get the function spacing: Normalized method name output display length collapse: Format method name and output between doc documents display 0: Display 1 According to the original document: Method name and Doc document Spacing between spaces" "defInfo (object, spacing=20, collapse=1): MethodList= [method forMethodinchDir (object)ifcallable (GetAttr (Object,method))]#1 and "a" or "B" #"a" #0 and "a" or "B" #"B"PROCESSFUC = collapse and(LambdaS" ". Join (S.split ()))or(Lambdas:s)Print("\ n". Join (["%s%s"% (method.ljust (spacing), Processfuc (str (getattr (Object,method).__doc__))) forMethodinchMethodList]))if __name__=='__main__': info (requests,collapse=0)
Python code implements Object document view