Python String Method – isdecimal()

Spread the love

isdecimal() Method –

isdecimal Method returns True if all the characters of a string are decimals otherwise it returns False.

Syntax –

string.isdecimal()

Example –

In [1]: string1 = '123456'

In [2]: string1.isdecimal()
Out[2]: True

In [3]: string2 = '123 456'

In [4]: string2.isdecimal()
Out[4]: False

In [5]: string3 = 'python3'

In [6]: string3.isdecimal()
Out[6]: False

Related Posts –

  1. Python String Method – Capitalize()
  2. Python String Method – title()
  3. Python String Method – center()
  4. Python String Method – count()
  5. Python String Method – startswith()
  6. Python String Method – endswith()
  7. Python String Method – find()
  8. Python String Method – index()
  9. Python String Method – isalnum()
  10. Python String Method – isalpha()

Rating: 1 out of 5.

Leave a Reply