Python注释用法

Python中的注释可用于解释任何程序代码。它也可以用来隐藏代码。

注释是任何程序中最有用的东西。它使我们能够了解程序的运行方式。在python中, 任何与#符号一起编写的语句都称为注释。解释器不解释注释。

注释不是程序的一部分, 但是它增强了程序的交互性并使程序可读。

Python支持两种类型的注释:

1)单行注释:

如果用户要指定单行注释, 则注释必须以?#开头。

例如:

# This is single line comment.
 print "Hello Python"

输出

Hello Python

2)多行注释:

可以在三引号内给出多行注释。

例如:

''' This
    Is
    Multipline comment'''

例如:

#single line comment
print "Hello Python"
'''This is
multiline comment'''

输出

Hello Python

来源:

https://www.srcmini02.com/31113.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_35589.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?