点击运行
x = "hello" if not type(x) is int: raise TypeError("Only integers are allowed")
运行结果