作者:
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 不直覺的就跑過去了