判断对象是否是元组:
isinstance(val, types.TupleType)
或
types.TupleType == type(val)
判断是否是函数:
isinstance(func, types.FunctionType)
需要引入types模板,获取数据类型:
inport types
types取值:
BooleanType
BufferType
BuiltinFunctionType
BuiltinMethodType
ClassType
CodeType
ComplexType
DictProxyType
DictType
DictionaryType
EllipsisType
FileType
FloatType
FrameType
FunctionType
GeneratorType
GetSetDescriptorType
InstanceType
IntType
LambdaType
ListType
LongType
MemberDescriptorType
MethodType
ModuleType
NoneType
NotImplementedType
ObjectType
SliceType
StringType
StringTypes
TracebackType
TupleType
TypeType
UnboundMethodType
UnicodeType
XRangeType