Python String isalnum() Method


Contents

Description

The isalnum() method in Python String checks whether the string comprises of the alphanumeric characters.

Syntax

Here is the syntax for isalnum() method:

str.isalnum()

Parameters

  • NA

Return Value

This method returns true in case all characters are alphanumeric in the string and there lies at least one character, otherwise, it returns false.

Example

The following example shows the usage of isalnum() method.

#!/usr/bin/python

str = "this2009";  # No space in this string
print str.isalnum()

str = "this is string example....wow!!!";
print str.isalnum()

When we run above program, it produces following result:

True
False

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.



Navigation
Tutorial
Tutorial
Tutorial