Write the syntax of isdecimal( ) and give suitable example
Answers
Answered by
2
Write the syntax of isdecimal( ) and give suitable example
Answered by
2
Syntax details of isdecimal( ) method
Explanation:
The isdecimal() method of python string tests whether the string comprises only decimal characters. This process only exists on artifacts with unicode.
- Syntax - str.isdecimal()
- Parameters - None
- Return Value - This returns true if all of the string characters are decimal, else false.
The following example shows the usage of isdecimal() method.
- #!/usr/bin/python
- # contains numbers
- s = "12345"
- print(s.isdecimal())
- True
- # contains alphabets
- s = "12abcd34"
- print(s.isdecimal())
- False
- # contains numbers and spaces
- s = "12 34"
- print(s.isdecimal())
- False
Similar questions
English,
5 months ago
Physics,
5 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
Chemistry,
1 year ago
Math,
1 year ago