Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

is digit python

is digit() python:  

  • The isdigit()  in python is defined as the string that consists of only digit values. 
  • It returns the result in boolean type if the string has only digits it returns true else false.
  • It accepts the Unicode of that characters also. and also the exponents like ^2.
  • It is not applicable to whitespace, special symbols, alphabets.
Syntax: str.isdigit().

Example:  str="123456"
                 str.isdigit(str) retrns true
Beacuse "123456" is perfectly a digit.
               str=\u00B0
               str.isdigit(str)returns true
Because it takes the Unicode as digit characters.

#write a python code  to demonstrate isdigit() function.

  1. a="7656734"
  2. a=str.isdigit(a)
  3. print(a)
  4. b="2344.60 
  5. b=str.isdigit(b)
  6. print(b)
  7. x="\u00B2"
  8. x=str.isdiigt(x)
  9. print(x)
output: true
            false
            true

2


This post first appeared on Java Tutorial - InstanceOfJava, please read the originial post: here

Share the post

is digit python

×

Subscribe to Java Tutorial - Instanceofjava

Get updates delivered right to your inbox!

Thank you for your subscription

×