What is the special character to mark a comment in Python?
In Python, comments are used with statements to give a description of the statement or to signify its usage to the programmer or the program reader.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our W3Make Forum to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
In Python programming language, the ‘#’ or Hash symbol is used to write comments.
But do remember that the ‘#’ or Hash symbol only makes a single line comment, i.e., using this will only make a single line to be commented out.
To write multiline comments or multiple lines as comments, you can simply use 3 Double inverted commas or 3 Quotation marks, i.e., like this “””<your comment here>”””.
The text written between the 3 Quotation marks will be treated as a comment.
Comments in Python
In the picture above, you can see that the ‘#’ character is supposed to be written again and again at each line to mark it as a comment because ‘#’ is a single line comment. It can also be observed that the 3 Quotation marks has been used only once to comment out multiple lines of comment which helps us in a better way.