28.10.2021 Views

Python Tutorial ( PDFDrive )

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Parameters

• NA

Return Value

This method returns true if all characters in the string are numeric, false otherwise.

Example

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

#!/usr/bin/python

str = u"this2009";

print str.isnumeric();

str = u"23443434";

print str.isnumeric();

Let us compile and run the above program, this will produce the following result:

False

True

isspace()

Description

The method isspace() checks whether the string consists of whitespace.

Syntax

Following is the syntax for isspace() method:

str.isspace()

Parameters

• NA

Return Value

This method returns true if there are only whitespace characters in the string and there is at least one character,

false otherwise.

Example

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

#!/usr/bin/python

str = " ";

print str.isspace();

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!