[Tutor] where to insert?

Goofball223@wmconnect.com Goofball223 at wmconnect.com
Thu Sep 22 23:57:41 CEST 2005


I would like to insert string.join(msgList,"") into the following program 
where do I insert it?

# numbers2text.py
#     A program to convert a sequence of ASCII numbers into
#         a string of text.

import string  # include string library for the split function.

def main():
    print "This program converts a sequence of ASCII numbers into"
    print "the string of text that it represents."
    print
    
    # Get the message to encode
    inString = raw_input("Please enter the ASCII-encoded message: ")

    # Loop through each substring and build ASCII message
    message = ""
    for numStr in string.split(inString):
        asciiNum = eval(numStr)           # convert digits to a number
        message = message + chr(asciiNum) # append character to message

    print "The decoded message is:", message

main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050922/61716a2e/attachment.htm


More information about the Tutor mailing list