zoukankan      html  css  js  c++  java
  • python 中所有原始类型

    判断对象是否是元组:

    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

  • 相关阅读:
    053587
    053586
    053585
    053584
    053583
    053582
    053581
    053580
    053579
    053578
  • 原文地址:https://www.cnblogs.com/sen-2017/p/11398332.html
Copyright © 2011-2022 走看看