Home » Python String | isdecimal() method with Examples

Python String | isdecimal() method with Examples

by Online Tutorials Library

Python String isdecimal() Method

Python isdecimal() method checks whether all the characters in the string are decimal or not. Decimal characters are those have base 10.

This method returns boolean either true or false.

Signature

Parameters

No parameter is required.

Return

It returns either True or False.

Let’s see some examples of isdecimal() method to understand it’s functionalities.

Python String isdecimal() Method Example 1

A simple example of isdecimal() method to check whether the string contains decimal value.

Output:

False  

Python String isdecimal() Method Example 2

Let’s try to check floating value and see the outcome. It will return False if string is not decimal.

Output:

True  False  

Python String isdecimal() Method Example 3

Here, we are checking special chars also.

Output:

True  False  

Next TopicPython Strings

You may also like