Python type(anyObj) 函数与 types 模块

示例:

 

>>> import types

 

>>> type([])

>>> type([]) is types.ListType
True

 

>>> print type.__doc__
type(object) -> the object's type
type(name, bases, dict) -> a new type

 

>>> print types.__doc__
Define names for all type symbols known in the standard interpreter.

Types that are part of optional modules (e.g. array) are not listed.

 

>>> print ''.join("%s /n" % e for e in dir(types) if e[:2]!='__')
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

你可能感兴趣的:(PYTHON,types,python,object,import,list)