from types import StringType, IntType def is_int (n): if type (n) == StringType: try: int (n) except ValueError: return 0 else: return 1 else: return type (n) == IntType if __name__ == '__main__': print is_int (0) print is_int (5.4) print is_int ('Hi there') Hope this helps. Alex.