# Python CodeRecipe|isdigit()の使い方

Home String Methods

# isdigit()の例1

Check if all the characters in the text are digits:

    txt = "50800"x = txt.isdigit()
print(x)

# isdigit()の定義及び使い方

The isdigit() method returns True if all the characters are digits, otherwise False. Exponents, like ², are also considered to be a digit.

# isdigit()の構文

string.isdigit()

# isdigit()の引数

パラメータがありません。

# isdigit()の例2

Check if all the characters in the text is alphabetic:

    a = "\u0030" #unicode for 0b = "\u00B2" #unicode 
    for ²print(a.isdigit())print(b.isdigit())

Home String Methods