看板 Python 關於我們 聯絡資訊
https://leetcode.com/problems/merge-k-sorted-lists/description/ my code https://paste.ubuntu.com/p/MBqn88Z78b/ 選python2 可以過 python3出現下面錯誤 Line 18: TypeError: unorderable types: ListNode() < ListNode() 根據python3 doc https://docs.python.org/3/library/heapq.html#basic-examples python2 vs python3 heapq都用tuple第一個元素來當作比較, 而我也將itm[0]放了int 請問我的python3問題在哪呢? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 8.41.187.50 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1535481281.A.68D.html ※ 編輯: sean72 (8.41.187.50), 08/29/2018 02:37:02
djshen: 就exception寫的阿 08/29 08:17
djshen: 你應該關心的是為什麼python2會過 08/29 08:23
cutekid: https://bitly.com/2oi5mcv 08/29 10:35
handsomeLin: 因為第一個一樣 比第二個 08/29 10:59