Python max() Method

Python 字符串Python String


Description

The Python max() method returns the largest alphabetical character in the string.

Syntax

The syntax of the max() method is:

max(str)

Parameters

  • str -- String.

Return Value

Returns the largest alphabetical character in the string.

Example

The following example demonstrates the usage of the max() function:

#!/usr/bin/python

str = "this is really a string example....wow!!!";
print "Max character: " + max(str);

str = "this is a string example....wow!!!";
print "Max character: " + max(str);

The output of the above example is as follows:

Max character: y
Max character: x

Python 字符串Python String

Other Extensions