Python pass 语句

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

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

pass

实例:

#!/usr/bin/python

for letter in 'Python': 
   if letter == 'h':
      pass
      print 'This is pass block'
   print 'Current Letter :', letter

print "Good bye!"

以上实例执行结果:

Current Letter : P
Current Letter : y
Current Letter : t
This is pass block
Current Letter : h
Current Letter : o
Current Letter : n
Good bye!