Python API

I start with Python coming from java.

I was wondering if there is something similar to the JavaDoc API where I can find the class, its methods and an example of how to use it.

I found very helpul for using help (stuff) from Python (command line)

I also found this:

http://docs.python.org/2/

https://docs.python.org/2/py-modindex.html

But it seems like it helps when you already have the class name you are looking for. In the JavaDoc API, I have all the classes, so if I need something, I scroll down to the class that โ€œsoundsโ€ what I need. Or several times I just go through all the classes to see what they do, and when I need a function, my brain remembers me. We saw something similar in javadoc, remember !?

But I donโ€™t seem to find it in Python (yet) and why I am posting this quest.

By the way, I know that in the end I will read this:

https://docs.python.org/2/library/

But, I think this is not today.

+6
python reference documentation
source share
9 answers

pydoc ?

I'm not sure if you are looking for something more complex, but this is a trick.

+5
source share

The standard python library is fairly well documented. Try switching to python and import the module, say "os" and run:

import os help(os) 

This reads the document lines for each element of the module and displays it. This is the same as pydoc.

EDIT: epydoc is probably exactly what you are looking for:

+2
source share

Here is a list of all the modules in Python, not sure if this is true.

+1
source share

I downloaded Python 2.5 from Python.org and does not contain pydoc.

 Directorio de C:\Python25 9/23/2008 10:45 PM <DIR> . 9/23/2008 10:45 PM <DIR> .. 9/23/2008 10:45 PM <DIR> DLLs 9/23/2008 10:45 PM <DIR> Doc 9/23/2008 10:45 PM <DIR> include 9/25/2008 06:34 PM <DIR> Lib 9/23/2008 10:45 PM <DIR> libs 2/21/2008 01:05 PM 14,013 LICENSE.txt 2/21/2008 01:05 PM 119,048 NEWS.txt 2/21/2008 01:11 PM 24,064 python.exe 2/21/2008 01:12 PM 24,576 pythonw.exe 2/21/2008 01:05 PM 56,354 README.txt 9/23/2008 10:45 PM <DIR> tcl 9/23/2008 10:45 PM <DIR> Tools 2/21/2008 01:11 PM 4,608 w9xpopen.exe 6 archivos 242,663 bytes 

But it has (substitute, I think) pydocgui ...

 C:\Python25>dir Tools\Scripts\pydocgui.pyw 10/28/2005 07:06 PM 222 pydocgui.pyw 1 archivos 222 bytes 

This starts the web server and shows what I was looking for. All modules plus all classes that come with the platform.

Doc dir contains the same as in:

http://docs.python.org/

Thanks so much for guiding me to pydoc.

+1
source share

By the way, I know that in the end I will read the following:

http://docs.python.org/lib/lib.html

But, I think this is not today.

I suggest you make a mistake. There is a "class, its methods and usage example" in lib doc. This is what you are looking for.

I use both Java and Python all the time. Dig into a library document, you will find everything you are looking for.

+1
source share

You can set the PYTHONDOCS environment variable to indicate where the python documentation is installed.

On my system, this is in / usr / share / doc / python 2.5

So you can define this variable in your shell profile or elsewhere depending on your system:

export PYTHONDOCS = / usr / share / doc / python2.5

Now, if you open the python interactive console, you can call the help system. For example:

 >>> help(Exception) >>> Help on class Exception in module exceptions: >>> class Exception(BaseException) >>> | Common base class for all non-exit exceptions. >>> | >>> | Method resolution order: >>> | Exception 

The documentation is here:

https://docs.python.org/library/pydoc.html

+1
source share

If you are working on Windows, ActiveState Python comes with documentation, including a link to the library in the search help file.

0
source share

It does not directly answer your question (so I will probably be demoted), but you might be interested in Jython .

Jython is an implementation of a high-level, dynamic, object-oriented Python language written in 100% Pure Java and seamlessly integrated with the Java platform. This way you can run Python on any Java platform.

Since you work with Java, Jython can help you use Python, however, allowing you to use Java knowledge.

0
source share

Also try

 pydoc -p 11111 

Then type in the web browser http: // localhost: 11111

EDIT: of course, you can use any other value for the port number instead of 11111

0
source share

All Articles