isdigit python library code example Example 1: isdigit python s='12' s.isdigit()#returns True Example 2: python isdigit my_char.isdigit()