Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python pass Statement

Python pass Statement

The Python pass is a null statement, intended to preserve the integrity of the program structure.

pass It does nothing and is generally used as a placeholder statement.

The syntax of the pass statement in the Python language is as follows:


pass

Test example:

Example

#!/usr/bin/python

-- coding: UTF-8 --

Output each letter of Python

for

letter

in

'

Python

'

:

if

letter

==

'

h

'

:

pass

print

'

This is the pass block

'

print

'

Current letter :

'

,

letter

print

"

Good bye!

"

The example above produces:


当前字母 : P
当前字母 : y
当前字母 : t
这是 pass 块
当前字母 : h
当前字母 : o
当前字母 : n
Good bye!