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
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
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.
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
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
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