Re: error with string (beginner)

2006-06-26 Thread Bruno Desthuilliers
Jason wrote: I believe what you are trying to do is something like the following. [code] def isIntLike(x): try:int(x) except: return False *Never* ever use a bare except clause. *Always* specify wich exceptions you are expecting. (NB : here, TypeError and ValueError). (NB

error with string (beginner)

2006-06-25 Thread Alex Pavluck
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

Re: error with string (beginner)

2006-06-25 Thread K.S.Sreeram
Alex Pavluck wrote: String: Source for exec/eval is unavailable I'm not able to find this message anywhere in the Python-2.4.3 sources. What python version are you using? What input did you enter when the prompt appeared? and copypaste the *exact* exception you got including the full traceback.

Re: error with string (beginner)

2006-06-25 Thread Jon Clements
Alex Pavluck 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

Re: error with string (beginner)

2006-06-25 Thread Jason
I believe what you are trying to do is something like the following. [code] def isIntLike(x): try:int(x) except: return False else: return True something = raw_input(Enter something and I will tell you the type: ) if isIntLike(something):print I am an int

Re: error with string (beginner)

2006-06-25 Thread Cameron Laird
In article [EMAIL PROTECTED], Alex Pavluck [EMAIL PROTECTED] 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