Home  >  Article  >  Backend Development  >  Python pass statement

Python pass statement

高洛峰
高洛峰Original
2016-11-23 10:43:241058browse

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

The Python language pass statement syntax is as follows:

pass

Example:

#!/usr/bin/python
 
for letter in 'Python': 
   if letter == 'h':
      pass
      print 'This is pass block'
   print 'Current Letter :', letter
 
print "Good bye!"

The above example execution result:

Current Letter : P

Current Letter : y

Current Letter : t

This is pass block

Current Letter : h

Current Letter : o

Current Letter : n

Good bye!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Python numbersNext article:Python numbers