Write the syntax for isalnum( ) method.
Answers
Answered by
2
•The isalnum() method is used to give "True" or "False".
• If all the characters in the string are alphanumeric it will return TRUE.
• If not then return FALSE.
• Syntax:
name= "RAMESH385"
print (name.isalnum())
Output: True
Answered by
0
Syntax for isalnum( ) method
Explanation:
Python isalnum() string method tests whether the string consists of alphanumeric characters or not.
- Syntax - str.isalnum()
- Parameters - Takes no parameters
- Return Value - This method returns true if all characters in the string are alphanumeric and false if at least one character is not alphanumeric.
Example:
- #!/usr/bin/python
- str = "this2020";
- print str.isalnum()
- str = "this is string isalnum() example.";
- print str.isalnum()
The above program gives the following output −
- True
- False
Similar questions
Math,
5 months ago
English,
5 months ago
English,
5 months ago
Computer Science,
10 months ago
Physics,
1 year ago