Python 不同数据类型比较

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.

这是我的个人日记本
原文地址:https://www.cnblogs.com/valentineisme/p/4242981.html