isdigit(), isdecimal(), isalpha()

.isdigit()

  • Checks if all characters in string is digit

'76'.isdigit()  # Evaluates to True
'1.2'.isdigit() # Evalutates to False

.isdecimal()

Is decimal works the same way as .isdigit()

'76'.isdigit()  # Evaluates to True
'1.2'.isdigit() # Evalutates to False

.isalpha()

  • Checks if all characters in the text are letters

'abc'.isalpha() # Evaluates to True
'76'.isalpha()  # Evaluates to False

Last updated