isdecimal() function in python by R4R Team

- isdecimal() is a python in-build function which return True or False.
- it will True if string contain only decimal numbers
- and it will give False if string contain any alphabet or otherthing except the decimal number.



program-

s="my123text"
print(s.isdecimal())

s="12345678"
print(s.isdecimal())


output-

False
True


-In this program, first string is "my123text" which is a combination of alphabet & number so isdecimal() function return False but in second string "12345678" it is only a decimal number so isdecimal() function will return True.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!