Latest web development tutorials

Pythonのパス文

Pythonは、プログラムの構造の完全性を維持するために、空の文を渡します。

一般的にプレースホルダステートメントとして使用するものを、実行せずに通過します。

次のようにPython言語パスステートメントの構文は次のとおりです。

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!