当前位置:K88软件开发文章中心编程语言PythonPython01 → 文章内容

Python pass 语句

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-11 12:44:11

Python pass 语句Python pass是空语句,是为了保持程序结构的完整性。pass 不做任何事情,一般用做占位语句。Python 语言 pass 语句语法格式如下:pass实例:





#!/usr/bin/python





# -*- coding:





UTF-8 -*-











# 输出 Python 的每个字母for letter in 'Python':





if letter == 'h':





pass print '这是 pass 块' print '当前字母 :





', letterprint "Good bye!"以上实例执行结果:当前字母 :





P当前字母 :





y当前字母 :





t这是 pass 块当前字母 :





h当前字母 :





o当前字母 :





nGood bye!

Python pass 语句