2019-03-29
阅读量:
580
如何在python中类型判断?
如何在python中类型判断?
答:
使用type(obj)来查看obj的类型
type(obj): 返回obj的类型
type(1) # int
type(1.0) # float
type('1') # str
type(True) # bool
isinstance(obj,class): 测试对象obj是class的实例
isinstance(1,int) # True
isinstance('1',str) # True






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论