[Tutor] Decoding

bob gailer bgailer at alum.rpi.edu
Mon Aug 13 03:24:39 CEST 2007


Eric Walker wrote:
> newbie here,
>   
Welcome
> I just tried playing around with the dec function and
> I get errors. 
Please always post the traceback (error message), and the code you are 
using.
> Correct me if I am wrong. After getting
> the input, 
What input is dec() expecting? As I read it the input is intended to be 
a string of numbers separated by whitespace. Something like 33 34 35 
(which should decode to "abc").
> the string.split will parse the string
> across whitespace chars so in other words you get a
> list of each word entered. 
True
> Then when it does the
> eval(x) part it dies. I tries to evaluate the word to
> be an existing variable or something. Am I missing
> something here.
>   
The reference says:
"eval(expression, ...)* *The expression argument is parsed and evaluated 
as a Python expression.

**



More information about the Tutor mailing list