每天一个 Python 小知识 isinstance
首先来看下 w3schools 的解释: Example Check if the number 5 is an integer: x = isinstance(5, int) Definition and Usage The isinstance() function returns True if the specified object is of the specified type, otherwise False. If the type parameter is a tuple, this function will return True if the object is one of the types in the tuple. Syntax isinstance(object, type) Parameter Values Parameter Description object Required....