您的位置:首页 > 编程语言 > Python开发

Python 不同数据类型比较

2015-01-22 23:27 477 查看
temp = '32'
if temp > 85:
print "Hot"
elif temp > 62:
print "Comfortable"
else:
print "Cold"


结果输出为Hot.

Why?

Essentially, "...the choice whether one object is considered smaller or larger than another one is made arbitrarily but consistently" means that when comparing objects of different types (ex. string with an int) the choice of which to always be larger was made arbitrarily. In this case, any string is always bigger than any int.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: