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

Python pass 语句

2016-05-03 18:46 696 查看
Python pass是空语句,是为了保持程序结构的完整性。

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

范例:

# 输出 Python 的每个字母
for letter in 'Python':
if letter == 'h':
pass
print 'This is pass block'
print 'current char:', letter
print "Bye!"

结果:
current char: P
current char: y
current char: t
This is pass block
current char: h
current char: o
current char: n
<pre name="code" class="python">Bye!

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python pass