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.
相关文章推荐
- 不同语言的数据类型比较[小糊涂的灵感]
- python输出不换行(同一行输出不同类型数据)
- Python【基础:数据类型和变量 字符串和编码 list和tuple 条件判断 循环 dict和set】注意事项(与java,c比较)
- Python和其他编程语言数据类型的比较
- python中对于“+”符号,不同的数据类型表现的不同的行为
- 不同数据类型数据的比较大小
- 不同类型数据与零值的比较
- python内置数据类型:list,tuple,dict比较
- oracle不同数据类型存储空间的实例比较
- Python 数据处理2(不同数据类型转列表输出)
- 主流数据库之间对SQL:2003标准的不同实现方法比较(第六部分 基础数据类型之BOOLEAN)
- 不同数据类型与零值比较的if从句
- Python 和其他编程语言数据类型的比较
- 【JS基础】类型转换——不同数据类型比较
- python 之 不同类型对象的内存占用、大小比较
- python---数据结构与数据类型,list,dict,tuple,排序sort,比较cmp,字符串模版
- python:global,可变数据类型与不可变数据类型,在声明全局变量中的不同
- C\C#\Java\Python 基本数据类型比较
- PHP之——不同类型数据之间的比较规律
- 不同数据类型if语句的与“零值”比较