1.23 数值与字符串的比较 ======================= .. image:: http://image.iswbm.com/20200804124133.png 在 Python2 中,数字可以与字符串直接比较。结果是数值永远比字符串小。 .. code:: python >>> 100000000 < "" True >>> 100000000 < "hello" True 但在 Python3 中,却不行。 .. code:: python >>> 100000000 < "" TypeError: '<' not supported between instances of 'int' and 'str'