Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs

Python isdecimal

by suresh

The Python isdecimal string function returns True if all the characters in a string are decimal characters. Otherwise, it returns False. In this section, we explain to you how to write isdecimal function with example. The syntax of the isdecimal function is

String_Value.isdecimal()

Python isdecimal Example

The following set of examples helps you understand the string isdecimal function. Within the fourth statement, 100.23 is returning false because there is no decimal representation for . symbol.

# Python isdecimal Method Example
 
str1 = "100"
print("Output of str1 = ", str1.isdecimal())
 
str2 = "Python"
print("Output of str2 = ", str2.isdecimal())
 
str3 = "100and200"
print("Output of str3 = ", str3.isdecimal())
 
str4 = "100.23"
print("Output of str4 = ", str4.isdecimal())
 
str5 = "100 30"
print("Output of str5 = ", str5.isdecimal())
Python isdecimal 1

String isdecimal Example 2

In this String function example, we are using the isdecimal function against the Unicode of different digits. Within the last statement, we used the Unicode of $ symbol, and that’s the reason Python was returning false.

str1 = "\u0033" # Unicode of Digit 3
print("Output of str1 = ", str1.isdecimal())
 
str2 = "\u0039" # Unicode of Digit 9
print("Output of str2 = ", str2.isdecimal())
 
str3 = "\u06F1" #Extended Arabic-Indic Digit 1
print("Output of str3 = ", str3.isdecimal())
 
str4 = "\u07C9" # Niko Digit 9
print("Output of str4 = ", str4.isdecimal())
 
str5 = "\u096C" # Devanagari Digit 6
print("Output of str5 = ", str5.isdecimal())
 
str6 = "\u0024" # Unicode of $ Symbol
print("Output of str6 = ", str6.isdecimal())
Python isdecimal 2

Placed Under: Python

  • Download and Install Python
  • Python Arithmetic Operators
  • Python Assignment Operators
  • Python Bitwise Operators
  • Python Comparison Operators
  • Python Logical Operators
  • Python If Statement
  • Python If Else
  • Python Elif Statement
  • Python Nested If
  • Python For Loop
  • Python While Loop
  • Python Break
  • Python Continue
  • Python Dictionary
  • Python datetime
  • Python String
  • Python Set
  • Python Tuple
  • Python List
  • Python List Comprehensions
  • Python Lambda Function
  • Python Functions
  • Python Types of Functions
  • Python Iterator
  • Python File
  • Python Directory
  • Python Class
  • Python classmethod
  • Python Inheritance
  • Python Method Overriding
  • Python Static Method
  • Connect Python and SQL Server
  • Python SQL Create DB
  • Python SQL Select Top
  • Python SQL Where Clause
  • Python SQL Order By
  • Python SQL Select Statement
  • Python len Function
  • Python max Function
  • Python map Function
  • Python print Function
  • Python sort Function
  • Python range Function
  • Python zip Function
  • Python Math Functions
  • Python String Functions
  • Python List Functions
  • Python NumPy Array
  • NumPy Aggregate Functions
  • NumPy Arithmetic Operations
  • Python Numpy Bitwise operators
  • Numpy Comparison Operators
  • Numpy Exponential Functions
  • Python Numpy logical operators
  • Python numpy String Functions
  • NumPy Trigonometric Functions
  • Python random Array
  • Python numpy concatenate
  • Python numpy Array shape
  • Python pandas DataFrame
  • Pandas DataFrame plot
  • Python Series
  • Python matplotlib Histogram
  • Python matplotlib Scatter Plot
  • Python matplotlib Pie Chart
  • Python matplotlib Bar Chart
  • Python List Length
  • Python sort List Function
  • Python String Concatenation
  • Python String Length
  • Python substring
  • Python Programming Examples
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy