Python pass 语句

来源:互联网 发布:淘宝开两家店 编辑:程序博客网 时间:2024/05/19 16:47

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

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

范例:

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

结果:

current char: Pcurrent char: ycurrent char: tThis is pass blockcurrent char: hcurrent char: ocurrent char: n<pre name="code" class="python">Bye!



0 0
原创粉丝点击