Python code implements Object document view

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.