Python pass语句用法示例

在Python中, pass关键字不执行任何操作;这意味着, 当我们不想执行代码时, 该过程可用于执行空操作。与名称所指相同。它只是使控件通过而无需执行任何代码。如果我们想绕过任何代码, 可以使用pass语句。

Python Pass语法

pass

Python Pass示例

for i in [1, 2, 3, 4, 5]:
    if i==3:
        pass
        print "Pass when value is", i
    print i, 

输出

>>> 
1 2 Pass when value is 3
3 4 5
>>>

来源:

https://www.srcmini02.com/31167.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_35570.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?