# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#python之函数用法isinstance() #isinstance()
#说明:返回一个布尔值,判断数据类型
'''
isinstance(...)
isinstance(object, class-or-type-or-tuple) -> bool
object:一个对象
class-or-type-or-tuple:类/基本类型/元组,可以只传一个数据类型,也可以同时传递多个数据类型
bool:返回一个布尔值 Return whether an object is an instance of a class or of a subclass thereof.
With a type as second argument, return whether that is the object's type.
The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for
isinstance(x, A) or isinstance(x, B) or ... (etc.).
''' #案例
object=range(5)#list
print isinstance(object,tuple)#False
print isinstance(object,list)#True object='xiaodeng'
print isinstance(object,(str,int))#True;同时传递多个数据类型
print isinstance(object,(str,int,list))#True;同时传递多个数据类型

最新文章

  1. Sql Server自动备份数据库,定期删除备份
  2. unity panel删除drawcall失败导致的残留影像
  3. jdbc 日期时间相关的类型
  4. 两种QMultiMap的遍历方法(最好使用只读遍历器)
  5. 搭了个hexo博客
  6. php抽象类和接口
  7. accept: Invalid argument linux 网络编程
  8. Canvas 实现灵动的红鲤鱼动画(上)
  9. caffe CuDNN报错问题解决
  10. CSS3及JS媒体查询教程
  11. echarts 移动端地图数据可视化教程
  12. Http协议状态码总结
  13. shell中的函数、数组、报警系统脚本
  14. C#使用Dotfuscator混淆代码的加密方法
  15. JMeter上架标的(yyb-csg)
  16. Learning-Python【23】:面向对象三大特性
  17. python使用关键字爬取url
  18. Ubuntu/Linux网络配置常用命令
  19. 基于Gogs+Drone搭建的私有CI/CD平台
  20. cygwin下如何运行crontab定时脚本?

热门文章

  1. 我对NHibernate的感受(4):令人欣喜的Interceptor机制
  2. MVC自定义路由02-实现IRouteConstraint限制控制器名
  3. 系统字体的Regular、Light等几种名称的区别
  4. leetCode解题报告5道题(九)
  5. C语言:自定义一个查找字串的功能函数,类似于<string.h>中的strstr()
  6. Sqrt(int x) leetcode java
  7. Vue路由scrollBehavior滚动行为控制锚点
  8. linux程序调试命令addr2line之入门简单介绍(本文先不聊gdb调试)
  9. SharpDevelop 版本信息
  10. [Node.js]30. Level 6: Listen 'Question' from client, and then Answer the Question