Your code is correct - you're probably using the wrong input. In your function to convert to ASCII, you're outputting a space-separated list of ints. If you input that ("104 101 108 108 111") back into your function to decode to text, it will fail. The input() function that your decode function uses to read input evaluates the command-line input as a python expression, so if you enter "[104, 101, 108, 108, 111]", it should work. If you want to work with the raw string, use the raw_input() that you use in your main function.
Also, pausing for several seconds between menu options isn't very good form in command-line interfaces.
By the way, it's a good idea to copy and paste your code into your post, embedded in [code] tags.
Last edited by astorm; 04-11-2006 at 07:59 PM.
|