Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python docstrings not working?

def myfunc():
    """ My docstring """
    print "hello"

help(myfunc)

I get

'more' is not recognized as an internal or external command,
operable program or batch file.

Windows 7 64bit, Python 2.6

like image 210
jjrtf Avatar asked Jun 05 '26 05:06

jjrtf


1 Answers

Python's help() function tries to, in your case, execute the more command. It should look something like this, when more is installed:

>>> help(myfunc)
Help on function myfunc in module __main__:

myfunc()
    My docstring

But you can also do

>>> print myfunc.__doc__
 My docstring

to read the docstring.

like image 183
naeg Avatar answered Jun 06 '26 19:06

naeg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!