+ 1

use of 3 "

Can anyone tell use of """ and short version of this string topic

15th Oct 2016, 3:55 PM
Naruto Uzumaki
Naruto Uzumaki - avatar
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!)
15th Oct 2016, 5:44 PM
Nelson Urbina
Nelson Urbina - avatar
+ 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.
16th Oct 2016, 7:17 PM
Sunera
Sunera - avatar
+ 4
Sunera is also right... I forgot that one.. thanks for clarifying it.
16th Oct 2016, 9:16 PM
Nelson Urbina
Nelson Urbina - avatar