Python ord ()

La fonction ord () renvoie un entier représentant le caractère Unicode.

La syntaxe de ord()est:

 ord (ch)

Paramètres ord ()

La ord()fonction prend un seul paramètre:

  • ch - un caractère Unicode

Valeur renvoyée par ord ()

La ord()fonction renvoie un entier représentant le caractère Unicode.

Exemple: comment ord () fonctionne en Python?

 print(ord('5')) # 53 print(ord('A')) # 65 print(ord('$')) # 36

Production

 53 65 36 

Au fait, la ord()fonction est l'inverse de la fonction Python chr ().

Articles intéressants...