Fil d’Ariane du forum – Vous êtes ici :ForumLangage Python: Langage Pythonconvertir une chaîne Python en AS …
Please Se connecter or S’enregistrer to create posts and topics.
convertir une chaîne Python en ASCII
webstart@webstart
15 messages
dominator@mderf64
88 messages
#2 · 29 juin 2024, 15 h 53 min
Citation de dominator le 29 juin 2024, 15 h 53 minLa fonction ord() python est destinée à convertir chaque caractère en code ascii. Ainsi pour convertir une chaine complètement en ascii on peut utiliser le code:
mystring = "Python" mystring_asccii = [ord(char) for char in mystring] print(mystring_asccii) # output : [80, 121, 116, 104, 111, 110]
La fonction ord() python est destinée à convertir chaque caractère en code ascii. Ainsi pour convertir une chaine complètement en ascii on peut utiliser le code:
mystring = "Python" mystring_asccii = [ord(char) for char in mystring] print(mystring_asccii) # output : [80, 121, 116, 104, 111, 110]
Cliquez pour un pouce descendu.0Cliquez pour un pouce levé.0
Post Views: 848 313