Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Ascii Text to Ascii Char Code Converter - Python Code Bank


Ascii Text to Ascii Char Code Converter
This is just showing a simple use of ord and chr functions
                ###########################################################################
#Python 2.6.4                                                             #
# a2cc: Ascii Text to Ascii Char code                                     #
# Author:  elmiguel                                                       #
# Description: This is just showing a simple use of ord and chr functions #
###########################################################################
def enc(s):
    output=[]
    output+=[str(ord(c)) for c in s]    
    return ' '.join(output)
    

def dec(s):
    output = []
    s = s.split(' ')
    output+=[chr(int(i)) for i in s]
    return ''.join(output)

e = "This is just a test"
print enc(e)

d = "84 104 105 115 32 105 115 32 106 117 115 116 32 97 32 116 101 115 116"
print dec(d)

            
Comments
Sorry but there are no comments to display