文章详情页
python基础,数据类型问题
浏览:43日期:2022-07-24 17:26:53
问题描述
print type(-10)=='int'
上面的代码为什么返回时 False?
type(-10) 是 整形数据啊。
问题解答
回答1:print(type(10) == int)True
你把 int 加上双引号就变成 str 了, 当然和 int 不一样了。
回答2:不是这么玩的。。。
type(-10) is int
isinstance(-10,int)
排行榜