+ 1
use of 3 "
Can anyone tell use of """ and short version of this string topic
3 Answers
+ 6
Those are used in Python to define Docstrings in your code.
Think of Docstring as special comments that are used for generation of documentation files of your code. They had their particular sintax and should not be used for just comment you code. For normal comments you have the # symbol.
To use them, they have to be written just after the def line or your function like this:
def someFunc():
"""
Everything here is a Docstring...
It can span as many lines as needed...
Enough!!
"""
print("Hello world!)
+ 5
Nelson is absolutely right
and """can be also used to create a multilinear string
string_var="""hello
this is a multiline string.
python will automatically
add \n at the
end of each line."""
print(string_var)
=>
hello
this is a multiline string.
python will automatically
add
at the
end of each line.
+ 4
Sunera is also right... I forgot that one.. thanks for clarifying it.