If you want check whether a variable contains a number, you will need to use isinstance(variable_name,type) function. See the example below:
if(isinstance(num,int) or isinstance(num,float)):
print "Not a number"
Posted by: Ly Meng | post date: 02-07-2013 | Subject: Python Programming Language
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: