Fonction help() – Python

La fonction help() en Python est utilisée pour afficher la documentation des modules, fonctions, classes, mots-clés, etc.

La fonction help() a la syntaxe suivante:
 

Syntaxe:
help(object)

 
 

Paramètres:

La méthode help() prend au maximum un paramètre.

  • objet(facultatif) – l’objet pour lequel vous souhaitez générer la documentation

 

Exemple:

Vérifions la documentation de la fonction print en Python.

help('print')

Sortie:

Help on built-in function print in module builtins:                                                                             
                                                                                                                                
print(...)                                                                                                                      
    print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)                                                          
                                                                                                                                
    Prints the values to a stream, or to sys.stdout by default.                                                                 
    Optional keyword arguments:                                                                                                 
    file:  a file-like object (stream); defaults to the current sys.stdout.                                                     
    sep:   string inserted between values, default a space.                                                                     
    end:   string appended after the last value, default a newline.                                                             
    flush: whether to forcibly flush the stream.

 
QCM Python

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *