error with string (beginner)

Cameron Laird claird at lairds.us
Sun Jun 25 12:49:30 EDT 2006


In article <1151240297.725336.305960 at i40g2000cwc.googlegroups.com>,
Alex Pavluck <apavluck at gmail.com> wrote:
>Hello. I get the following error with the following code.  Is there
>something wrong with my Python installation?
>
>code:
>import types
>something = input("Enter something and I will tell you the type: ")
>
>if type(something) is types.IntType:
>    print "you entered an integer"
>elif type(something) is types.StringType:
>    print "you entered a string"
>
>error:
>String: Source for exec/eval is unavailable
>

There are several things wrong--'least three distinct ones, by my count.

What version of Python do you believe you're using?  What input do you
enter at the "Enter something ..." prompt?

I suspect you're going to have happier results all around when you
replace "input" with "raw_input".  I encourage you to read the documenta-
tion for each.



More information about the Python-list mailing list