How to search help using python console

前端 未结 10 1301
长发绾君心
长发绾君心 2021-02-08 20:25

Is there any way to search for a particular package/function using keywords in the Python console?

For example, I may want to search \"pdf\" for pdf related tasks.

相关标签:
10条回答
  • 2021-02-08 20:58

    help( "modules")

    >>> help( "modules" )
    
    Please wait a moment while I gather a list of all available modules...
    
    C:\Program Files\Python26\lib\pkgutil.py:110: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or actively maintained.  Please switch to the wx package as soon
      __import__(name)
    ArgImagePlugin      WmfImagePlugin      dbhash              pyclbr
    BaseHTTPServer      XVThumbImagePlugin  decimal             pydoc
    Bastion             XbmImagePlugin      difflib             pydoc_topics
    BdfFontFile         XpmImagePlugin      dircache            pyexpat
    BmpImagePlugin      _LWPCookieJar       dis                 quopri
    BufrStubImagePlugin _MozillaCookieJar   distutils           random
    CGIHTTPServer       __builtin__         doctest             re
    Canvas              __future__          dumbdbm             repr
    ConfigParser        _abcoll             dummy_thread        rexec
    ContainerIO         _ast                dummy_threading     rfc822
    Cookie              _bisect             email               rlcompleter
    CurImagePlugin      _bsddb              encodings           robotparser
    DcxImagePlugin      _bytesio            errno               runpy
    Dialog              _codecs             exceptions          sched
    DocXMLRPCServer     _codecs_cn          filecmp             select
    EpsImagePlugin      _codecs_hk          fileinput           sets
    ExifTags            _codecs_iso2022     fnmatch             sgmllib
    FileDialog          _codecs_jp          formatter           sha
    FitsStubImagePlugin _codecs_kr          fpformat            shelve
    FixTk               _codecs_tw          fractions           shlex
    FliImagePlugin      _collections        ftplib              shutil
    FontFile            _csv                functools           signal
    FpxImagePlugin      _ctypes             future_builtins     site
    GbrImagePlugin      _ctypes_test        gc                  smtpd
    GdImageFile         _elementtree        genericpath         smtplib
    GifImagePlugin      _fileio             getopt              sndhdr
    GimpGradientFile    _functools          getpass             socket
    GimpPaletteFile     _hashlib            gettext             sqlite3
    GribStubImagePlugin _heapq              glob                sre
    HTMLParser          _hotshot            gzip                sre_compile
    Hdf5StubImagePlugin _imaging            hashlib             sre_constants
    IcnsImagePlugin     _imagingft          heapq               sre_parse
    IcoImagePlugin      _imagingmath        hmac                ssl
    ImImagePlugin       _imagingtk          hotshot             stat
    Image               _json               htmlentitydefs      statvfs
    ImageChops          _locale             htmllib             string
    ImageColor          _lsprof             httplib             stringold
    ImageDraw           _md5                idlelib             stringprep
    ImageDraw2          _msi                ihooks              strop
    ImageEnhance        _multibytecodec     imageop             struct
    ImageFile           _multiprocessing    imaplib             subprocess
    ImageFileIO         _random             imghdr              sunau
    ImageFilter         _sha                imp                 sunaudio
    ImageFont           _sha256             imputil             symbol
    ImageGL             _sha512             inspect             symtable
    ImageGrab           _socket             io                  sys
    ImageMath           _sqlite3            itertools           tabnanny
    ImageMode           _sre                json                tarfile
    ImageOps            _ssl                keyword             telnetlib
    ImagePalette        _strptime           lib2to3             tempfile
    ImagePath           _struct             linecache           test
    ImageQt             _subprocess         locale              textwrap
    ImageSequence       _symtable           logging             this
    ImageStat           _testcapi           macpath             thread
    ImageTk             _threading_local    macurl2path         threading
    ImageTransform      _tkinter            mailbox             time
    ImageWin            _warnings           mailcap             timeit
    ImtImagePlugin      _weakref            markupbase          tkColorChooser
    IptcImagePlugin     _winreg             marshal             tkCommonDialog
    JpegImagePlugin     abc                 math                tkFileDialog
    McIdasImagePlugin   aifc                md5                 tkFont
    MicImagePlugin      anydbm              mhlib               tkMessageBox
    MimeWriter          array               mimetools           tkSimpleDialog
    MpegImagePlugin     ast                 mimetypes           toaiff
    MspImagePlugin      asynchat            mimify              token
    OleFileIO           asyncore            mmap                tokenize
    PIL                 atexit              modulefinder        trace
    PSDraw              audiodev            msilib              traceback
    PaletteFile         audioop             msvcrt              tty
    PalmImagePlugin     base64              multifile           turtle
    PcdImagePlugin      bdb                 multiprocessing     types
    PcfFontFile         binascii            mutex               unicodedata
    PcxImagePlugin      binhex              netrc               unittest
    PdfImagePlugin      bisect              new                 update_manifest
    PixarImagePlugin    bsddb               nntplib             urllib
    PngImagePlugin      bz2                 nt                  urllib2
    PpmImagePlugin      cPickle             ntpath              urlparse
    PsdImagePlugin      cProfile            nturl2path          user
    Queue               cStringIO           numbers             uu
    ScrolledText        calendar            opcode              uuid
    SgiImagePlugin      cgi                 operator            warnings
    SimpleDialog        cgitb               optparse            wave
    SimpleHTTPServer    chunk               os                  weakref
    SimpleXMLRPCServer  cmath               os2emxpath          webbrowser
    SocketServer        cmd                 parser              whichdb
    SpiderImagePlugin   code                pdb                 winsound
    StringIO            codecs              pickle              wsgiref
    SunImagePlugin      codeop              pickletools         wx
    TarIO               collections         pipes               wxPython
    TgaImagePlugin      colorsys            pkgutil             wxversion
    TiffImagePlugin     commands            platform            xdrlib
    TiffTags            compileall          plistlib            xml
    Tix                 compiler            popen2              xmllib
    Tkconstants         contextlib          poplib              xmlrpclib
    Tkdnd               cookielib           posixfile           xxsubtype
    Tkinter             copy                posixpath           zipfile
    UserDict            copy_reg            pprint              zipimport
    UserList            csv                 profile             zlib
    UserString          ctypes              pstats
    WalImageFile        curses              pty
    WbmpImagePlugin     datetime            py_compile
    
    Enter any module name to get more help.  Or, type "modules spam" to search
    for modules whose descriptions contain the word "spam".
    
    >>>
    
    0 讨论(0)
  • 2021-02-08 21:01
    1. help(name of the function)
    2. if you are using jupyter or ipython notebook ,then adding "?" would bring dogstring for the code. this is helpful if you want to see help of specific function.example pandas.read_csv?.
    3. by pressing "Tab" you can see what you need to enter as parameters, although it would not give what a function does, but provide way to enter the input parameters.
    0 讨论(0)
  • 2021-02-08 21:02

    You can use help to access the docstrings of the different modules you have imported, e.g., try the following:

    help(math)
    

    and you'll get an error,

    import math
    help(math)
    

    and you will get a list of the available methods in the module, but only AFTER you have imported it. It also works with individual functions, e.g. after importing math try:

    help(math.sin)
    

    To deal with pdf you will probably have to install a third party module. A quick search has led me to this result, which I haven't tried:

    http://www.devshed.com/c/a/Python/Python-for-PDF-Generation/

    0 讨论(0)
  • 2021-02-08 21:03

    pip is an excellent resource. If pip is installed (if you don't have it, instructions are here), then using the Windows command shell you can do the following:

    pip search pdf
    

    It returns a plethora of options.

    C:\Python27\Scripts>pip search pdf
    mwlib.rl                  - generate pdfs from mediawiki markup
    slc.publications          - A content type to store and parse pdf publications
    PyPDFLite                 - Simple PDF Writer.
    pdfminer                  - PDF parser and analyzer
    zopyx.convert             - A Python interface to XSL-FO libraries (Conversion
                                HTML to PDF, RTF, DOCX, WML and ODT)
    WeasyPrint                - WeasyPrint converts web documents to PDF.
    zopyx.convert2            - A Python interface for the conversion of HTML to
                                PDF, RTF, DOCX, WML and ODT) - belongs to
                                zopyx.smartprintng.core
    collective.pdfpeek        - A Plone 4 product that generates image thumbnail
                                previews of PDF files stored on ATFile based
                                objects.
    pisa                      - PDF generator using HTML and CSS
    

    etc.

    0 讨论(0)
提交回复
热议问题