Python的pass语句

简介:

   Python pass是空语句,是为了保持程序结构的完整性。pass不做任何事情,一般用做占位语句。

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

1
pass


示例代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python
# -*- coding:utf8 -*-
for  letter  in  'python' :
     if  letter  = =  'h' :
         pass
         print  '这是pass 块'
     print  '当前字母:' ,letter
print  "Good bye!"
[root@Python  pass ] # python pass.py
当前字母: p
当前字母: y
当前字母: t
这是 pass 
当前字母: h
当前字母: o
当前字母: n
Good bye!





      本文转自027ryan  51CTO博客,原文链接:http://blog.51cto.com/ucode/1727212 ,如需转载请自行联系原作者

相关文章
|
3月前
|
程序员 Python
在Python编程语言中,`pass`语句
在Python编程语言中,`pass`语句
35 2
|
8月前
|
Python
Python pass空语句
Python pass空语句
26 0
|
28天前
|
Python
python学习3-选择结构、bool值、pass语句
python学习3-选择结构、bool值、pass语句
|
2天前
|
Python
【Python操作基础】——while语句用法和pass语句
【Python操作基础】——while语句用法和pass语句
|
7月前
|
Python
python中pass语句的用法
python中pass语句的用法
|
8月前
|
程序员 编译器 测试技术
【python基础知识】6.布尔值和四种语句(break、continue、pass、else)
【python基础知识】6.布尔值和四种语句(break、continue、pass、else)
97 0
【python基础知识】6.布尔值和四种语句(break、continue、pass、else)
|
9月前
|
Python
Python中pass、exit()的区别
Python中pass、exit()的区别
|
11月前
|
Python
7.从入门到精通:Python pass 语句,Number 类型转换,math 模块、cmath 模块
7.从入门到精通:Python pass 语句,Number 类型转换,math 模块、cmath 模块
|
12月前
|
Python
Python pass 语句
Python pass 语句
75 0
|
C语言 Python
python基础 判断语句
python基础 判断语句
104 0
python基础 判断语句