Python Forum
How to print the docstring(documentation string) of the input function ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to print the docstring(documentation string) of the input function ?
#1
Write a python script to print the docstring(documentation string) of the input function in Python 3? I’m new to Python and unable to find the answers for this question. I tried myself as below but no luck.

answer = input("question?")  # calls the function
obj = input  # doesn't call the function
docs = myobject.__doc__
docs = len.__doc__
print(something)
Reply
#2
Not very clear what you try to achieve, but
>>> print(input.__doc__)
Read a string from standard input.  The trailing newline is stripped.

The prompt string, if given, is printed to standard output without a
trailing newline before reading input.

If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
On *nix systems, readline is used if available.
>>>
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Input function Fabio87 11 5,854 Apr-29-2022, 03:50 PM
Last Post: Alex143
Bug How to print only vowels from an input? PP9044 8 7,427 Feb-26-2021, 04:02 PM
Last Post: Serafim
  Reading a text until matched string and print it as a single line cananb 1 1,997 Nov-29-2020, 01:38 PM
Last Post: DPaul
  Print user input into triangle djtjhokie 1 2,342 Nov-07-2020, 07:01 PM
Last Post: buran
  Why does this function print empty list? hhydration 1 1,501 Oct-28-2020, 02:03 AM
Last Post: deanhystad
  Question on "define function"; difference between return and print extricate 10 4,596 Jun-09-2020, 08:56 PM
Last Post: jefsummers
  Adding string numbers, while loop and exit without input. Jose 11 7,373 Apr-15-2020, 08:34 AM
Last Post: Jose
  Writing a function that changes its answer based on user input SirRavenclaw 2 2,759 Dec-21-2019, 09:46 PM
Last Post: Clunk_Head
  Print the longest str from user input edwdas 5 4,049 Nov-04-2019, 02:02 PM
Last Post: perfringo
  New to Python - tiny coding assistance on user input function and assign to variable Mountain_Duck 1 2,464 Mar-23-2019, 06:54 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020