Python basic in... LOGIN
Python basic introductory tutorial
author:php.cn update time:2022-04-18 16:14:50

Python pass statement


Python pass is an empty statement to maintain the integrity of the program structure.

pass does not do anything and is generally used as a placeholder statement.

The Python language pass statement syntax format is as follows:

pass

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 execution result of the above example:

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


php.cn