how to know if a variable is a tuple, a string or an integer?
make use of isinstance ?
if isinstance(var, int):
if isinstance(var, str):
if isinstance(var, tuple):
You just use:
type(varname)
which will output int, str, float, etc...
isinstance(obj, tuple)
isinstance(obj, basestring)
isinstance(obj, int)