how to print multiple docstring with in a function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to print multiple docstring with in a function

def shout(word): """ Print a word with an exclamation mark following it. """ print(word + "!") """ this section is not prinfed why? """ shout("spam") print (shout.__doc__) this is the code and second comment is not printed

10th Oct 2016, 3:49 PM
Abhishek
1 Answer
+ 1
You might want to look at this, as a validator (that may answer your question) and doc reference. http://dolphm.com/pep257-good-JUMP_LINK__&&__python__&&__JUMP_LINK-docstrings-by-example/amp/ Even though the Python docs (in the related PEP's) show what you're trying to do, the apparently strict definition is that they're supposed to be at line 1 in the local scope. People generally say not to get too clever with them.
10th Oct 2016, 5:01 PM
Kirk Schafer
Kirk Schafer - avatar