+ 1

Not sure about the difference between # and "" Fudd ""..

If I write "" this is a Multi-line comment "" And if I write # this is the first line # and this is the 2nd line comment What's the difference? Someone asked a similar question and the answer was that comments using # are ignored and can't be viewed at run time or whatever but I can see them just fine... Just like "" comment "" ...so what's the difference?

14th Aug 2016, 6:53 PM
Ryu
Ryu - avatar
5 odpowiedzi
+ 2
the # sign gives a single line comment but triple quotes are used for multiline comment also triple quotes are used for docstrings they carry a huge importance in modules and in programming also if you import a module and then type <module name>.help docstrings and functions are visible but not comments with#
17th Aug 2016, 5:11 PM
ritik tiwari
ritik tiwari - avatar
+ 1
if you use ... # my name is ryu ..... this will not be printed as it is a comment ... if you use ... """my name is run I love solo learn """ this will also not be printed .... now you would be thinking they what is the difference between these two... 1. # and """ """ are both made for comments but the # sign is only made for single line comment ... and .. """ is used for multi-line comment.. OTHER THAN THIS ..... if you type a comment in python shell .. using """.. you will get something else ... and the thing you will get is the format in which the code must be written if you want same in print statement.... hope you will understand.. if not please rate it up or down and I will get your response... and then I will try to give you another answer...
15th Aug 2016, 7:48 AM
Aakash Sharma
Aakash Sharma - avatar
- 1
The difference is when you use # is a line comment and "" is multi line. Imagine if your comments about a big function require many lines for explain that, you must write a # for every line while with multi line only use two
14th Aug 2016, 7:36 PM
Ricardo Rorry Salinas Escobar
Ricardo Rorry Salinas Escobar - avatar
- 1
So it's just the multi line feature? Thought there was more to it
14th Aug 2016, 9:22 PM
Ryu
Ryu - avatar
- 1
# used for singlline comment and """ used for multiline comment
15th Aug 2016, 9:29 AM
Bharati Deepak Giri