Latest web development tutorials

Pythonのisalnum()メソッド

Python文字列 Python文字列


説明

Pythonのisalnum()文字と数字の文字列を検出する方法があります。

文法

isalnum()メソッドの構文:

str.isa1num()

パラメータ

  • なし。

戻り値

そこに少なくとも一つの文字列があるとした場合、すべての文字は、文字または数字である真、そうでなければFalseを返します

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

#!/usr/bin/python

str = "this2009";  # No space in this string
print str.isalnum();

str = "this is string example....wow!!!";
print str.isalnum();

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

True
False

Python文字列 Python文字列