+ 1
Difference between # and """
What is the difference between between # and """? Which situations would exist in which one is used over the other?
3 Réponses
+ 4
Use # when you make code out commenting .. That makes code unexecutabe .. As the program running it skips this code.
But """ """ it's used when you right the discription of what that code gonna do that may help you or any one when he going to see the code.. And the programe read it while working but it doesn't give any output.
And # use for one line only.
But """ """ can use in multilines.
Wish that's helpful!
+ 1
# is just the single line comment. However triple quotes are far more complex than that
Its first way of using is used as multiple line string. In this way you can type single and double quote without any trouble.
The 2nd mean is used as multiple line comments. You can almostly put it anywhere you like.
The last usage of it is python doc. Just put it right after def clause like this:
Def myfunc():
'''
This a doc for this function
'''
Then you can access it by using__doc__ property
+ 1
# only works on a single line.
''' can be used on multiple lines but they are more complicated