楼主:
apua (Apua)
2015-03-05 11:59:42→ tiefblau: raw_input吃进来是string 03/01 23:36
推 tiefblau: 转型:加个b = int(b) 或是 用input()吃进来 推荐第一个 03/01 23:42
→ tiefblau: 因为python3就没raw_input了 还可避免人家输入奇怪东西 03/01 23:43
补充一下:
.. code:: Python
>>> '1' > 1 # in Python2.x
True
>>> '1' > 1 # in Python3.x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: str() > int()
用 Python3 至少你可以更快发现错误, 而不会像 Python2 不直觉的就跑过去了