Language Syntax
Comments — Python syntax
A hash outside a string starts a comment. The parser ignores ordinary comments, but an encoding declaration can affect source decoding and tools may interpret special comment directives. A string containing a hash is not a comment.
Formal Syntax & Structure
python syntaxpython
# comment to end of physical lineWorking Example
Example Snippetpython
value=3 # explanatory notetext='# not a comment'print((value,text))