Python pass 语句使用示例

Python pass 语句的使用方法示例。
Python pass是空语句,pass语句什么也不做,一般作为占位符或者创建占位程序,是为了保持程序结构的完整性,pass语句不会执行任何操作,比如:

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

复制代码代码如下:
pass

复制代码代码如下:
实例:

复制代码代码如下:
#!/usr/bin/python
# www.jbxue.com

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!
原文地址:https://www.cnblogs.com/linuxnotes/p/3595507.html