Python中的注释

来源:互联网 发布:不要网络的游戏 编辑:程序博客网 时间:2024/06/05 23:40

Python中的注释以 # 号开头,直至物理行的行尾结束。可是出现在字符串中则失去注释效果,仅被当作普通的#号。

Some examples:

# this is the first commentspam = 1  # and this is the second comment          # ... and now a third!text = "# This is not a comment because it's inside quotes."
Comments in Python start with the hash character, #, and extend to the end of the physical line. A comment may appear at the start of a line or following whitespace or code, but not within a string literal. A hash character within a string literal is just a hash character. Since comments are to clarify code and are not interpreted by Python, they may be omitted when typing in examples.                                             
0 0
原创粉丝点击