-3

Write a python script to print the docstring(documentation string) of the input function. Hint:

  • use help() function to get the docstring
4
  • 2
    What have you tried so far? Please post your code. SO is not a coding service. Commented Nov 1, 2019 at 11:14
  • 2
    help(input) worked, thanks. Commented Nov 1, 2019 at 11:17
  • Does this answer your question? python "help" function: printing docstrings Commented Nov 1, 2019 at 14:07
  • // , Upvoted because sometimes a duplicate helps get me better search results. Commented Oct 28, 2020 at 22:35

3 Answers 3

2

Expected answer is

help(input)
Sign up to request clarification or add additional context in comments.

Comments

1

The built-in input has a docstring so you're looking for this(?):

print(input.__doc__)

Calling help sure does work (python 2 and 3):

help(input)

2 Comments

I need the python script
That would be the one-liner with the print function having input.__doc__ as its sole argument.
-1

num = input(enter : ) ''' hello''' print(num.doc) GNU nano 2.9.3 test.py

def function(l):

    '''this is docstring'''
    return l

l1 = input('enter name : ')

v = function(l1) print(f'{function.doc} {l1}')

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.