Latest web development tutorials

python3 isdigitは()メソッド

python3文字列 python3文字列


説明

Pythonのisdigitは()数字のみで構成される文字列を検出する方法があります。

文法

isdigitは()メソッドの構文:

str.isdigit()

パラメータ

  • なし。

戻り値

文字列は真そうでなければFalse数値のみを返しますが含まれている場合。

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

#!/usr/bin/python3

str = "123456"; 
print (str.isdigit())

str = "w3big example....wow!!!"
print (str.isdigit())

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

True
False

python3文字列 python3文字列