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 '現在の文字 :', letter print "Good bye!"

上記の例の実行結果:

当前字母 : P
当前字母 : y
当前字母 : t
这是 pass 块
当前字母 : h
当前字母 : o
当前字母 : n
Good bye!
その他の拡張