How to Comment in Python
Add a hash character (#)., Know when a hashtag invokes a comment., Understand when a hashtag does not invoke a comment.
3 Steps
1 min read
Easy
Step-by-Step Guide
-
Step 1: Add a hash character (#).
This sometimes called a hashtag, a number symbol, or the pound sign.
When the script is executed, the Python compiler will ignore anything after the # until the end of that physical line. -
Step 2: Know when a hashtag invokes a comment.
A comment can start at the beginning of a line, after some code, or after a white space. , Within a string literal, (indicated by quotation marks), a hashtag is just a hashtag. -
Step 3: Understand when a hashtag does not invoke a comment.
Detailed Guide
This sometimes called a hashtag, a number symbol, or the pound sign.
When the script is executed, the Python compiler will ignore anything after the # until the end of that physical line.
A comment can start at the beginning of a line, after some code, or after a white space. , Within a string literal, (indicated by quotation marks), a hashtag is just a hashtag.
About the Author
A
Ashley Gibson
Brings years of experience writing about home improvement and related subjects.
27 articles
View all articles
Rate This Guide
--
Loading...
5
0
4
0
3
0
2
0
1
0
How helpful was this guide? Click to rate: