Latest web development tutorials

Pythonのisspace()メソッド

Python文字列 Python文字列


説明

Pythonのisspace文字列を検出するために()メソッドは、スペースのみで構成されています。

文法

isspace()メソッドの構文:

str.isspace()

パラメータ

  • なし。

戻り値

文字列にスペースだけが含まれている場合は、そうでなければFalse、Trueを返します。

次の例では、isspace()メソッドの例を示します。

#!/usr/bin/python

str = "       "; 
print str.isspace();

str = "This is string example....wow!!!";
print str.isspace();

次のように上記の出力結果の例は次のとおりです。

True
False

Python文字列 Python文字列