Méthode max() de Python

Python 字符串Chaîne Python


Description

La méthode Python max() renvoie le plus grand caractère alphabétique de la chaîne.

Syntaxe

La syntaxe de la méthode max() est :

max(str)

Parameters

  • str -- Chaîne de caractères.

Valeur de retour

Renvoie le plus grand caractère alphabétique dans la chaîne.

Exemple

L'exemple suivant illustre l'utilisation de la fonction max() :

#!/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);

La sortie de l'exemple ci-dessus est la suivante :

Max character: y
Max character: x

Python 字符串Chaîne Python

Autres extensions