Comments

Comments are not executed in Python, start with the character #, and end with the end of the line.

Input:

# source_code/appendix_c_python/example01_comments.py
print "This text will be printed because the print statement is executed."
#This is just a comment and will not be executed.
#print "Even commented statements are not executed."
print "But the comment finished with the end of the line."
print "So the 4th and 5th line of the code are executed again."

Output:

$ python example01_comments.py 
This text will be printed because the print statement is executed
But the comment finished with the end of the line.
So the 4th and 5th line of the code are executed again.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset