Quick links
Latest articles
Internship
Members
New...
Algorithms
Discrete Mathematics
Big data
Languages
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL
Web
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.
Programs
C
C++
DS
Java
C#
Python
Aptitude
C
C++
Java
DBMS
Interview
C
Embedded C
Java
SEO
HR
CS Subjects
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS
More...
Articles
Puzzles
News/Updates

Home » Python

Python String | isdecimal() Method with Example



Python String isdecimal() method: In this tutorial, we will learn about isdecimal() method of String in Python with Example.
Submitted by IncludeHelp, on July 07, 2018

isdecimal() is an in-built method in Python, which is used to check whether a string contains only decimal characters or not.

Note:

  • Decimal characters contain all digits from 0 to 9.
  • String should be Unicode object - to define a string as Unicode object, we use u as prefix of the string value.

Syntax:

    String.isdecimal();

Parameter: None

Return type:

  • true - If all characters of the string are decimal characters then method returns true.
  • false - If any of the characters of the string is not a decimal character then method returns false.

Example/program:

# str1 with only decimal characters
str1 = u"362436"
print str1.isdecimal ()

# str2 with alphabets and decimal characters
str2 = u"Hello36"
print str2.isdecimal ()

# str3 with alphabets and special characters
str3 = u"@Hell36#"
print str3.isdecimal ()

Output

    True
    False
    False

Reference: String isdecimal()






Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Featured post:
Introduction to Linux (Its modes, Safety, Most popular Applications)
Linux Best Distribution Software (Distros) of 2018

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates



© https://www.includehelp.com (2015-2018), Some rights reserved.