Comments

<< Click to Display Table of Contents >>

Navigation:  Scriptiing > Python >

Comments

Comments begin with the # symbol.

hash-mark comments are the most basic way to document your code. Python simply ignores all the text following a # (as long as it’s not inside a string literal), so you can follow this character with any words and descriptions meaningful to you.

# comments are best limited to smaller code documentation (e.g., “make sure file exists before opening it” ) and are best limited in scope to a statement or small group of statements within a script or function.