-1

I'm posting this question again, slightly different.

How to get help on methods in Python?

I use Jupyter Lab mostly.

I work mainly with numbers... but sometimes I need to manage strings as well... and I need to recall how to use some methods. So, I need to go online to the forums or search on my notebooks to see how I did this and that...

Is there a way to obtain a docstring with the list of builtin methods available for an object using 'help'? or '?'?

and,

Is there a way to get help on methods without creating an object for that? Like

x = 'x'
x.split?

Thanks

1 Answers1

1

The python help function is used to display the documentation of modules, functions, classes, keywords etc. The help function has the following syntax:

help([object])

If the help function is passed without an argument, then the interactive help utility starts up on the console.

x="ab"
help(x.split)
Help on built-in function split:

split(...) method of builtins.str instance
    S.split(sep=None, maxsplit=-1) -> list of strings
    
    Return a list of the words in S, using sep as the
    delimiter string.  If maxsplit is given, at most maxsplit
    splits are done. If sep is not specified or is None, any
    whitespace string is a separator and empty strings are
    removed from the result.

Official Docs: Documentation

Kuldeep Singh Sidhu
  • 3,748
  • 2
  • 12
  • 22