您的位置:首页 > 编程语言 > Python开发

Python菜鸟--pass语句

2016-11-01 22:51 671 查看
来源:http://www.runoob.com/python/python-pass-statement.html

Python pass是空语句,是为了保持程序结构的完整性。

pass 不做任何事情,一般用做占位语句。

Python 语言 pass 语句语法格式如下:
pass


实例:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# 输出 Python 的每个字母
for letter in 'Python':
if letter == 'h':
pass
print '这是 pass 块'
print '当前字母 :', letter

print "Good bye!"


以上实例执行结果:
当前字母 : P
当前字母 : y
当前字母 : t
这是 pass 块
当前字母 : h
当前字母 : o
当前字母 : n
Good bye!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: