Re: [問題] 新手請益

看板Python作者 (渴望平凡的幸福)時間15年前 (2009/03/19 20:59), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/16 (看更多)
※ 引述《justlink (('(oo)'))》之銘言: : 版本 3.1a : 使用 win32 idle : e = "e " : print(e is "e ") : 得到True 這是 "e " 被自動 intern 了,所以兩者是「同一個物件」 : Shell 底下 : False : 囧rz 這是? 這是沒有被 intern 的情形 請參考內建函式 intern() 的說明,一般來說「不要假設字串會被自動 intern」 比對字串內容是否相符的時候,請用 == : 另外關於 : round(2.5) : 這個問題的答案為何是2? python 3.0 的 round() 改成 round-to-even -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.117.40.88
文章代碼(AID): #19ma6nWS (Python)
討論串 (同標題文章)
文章代碼(AID): #19ma6nWS (Python)