作者Aungk (菲依)
看板Python
標題[問題] 字串解法
時間Wed Jul 6 14:26:06 2016
有一個字串'0a12bc'
要怎麼把它變成0a12bc呢? 據查他的type是class,可是不能用int變回去。
因為,某一段函數需要把它讀進來。
謝謝~
--
Sent from my Windows
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.124.249.117
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1467786369.A.F6D.html
→ alibuda174: int('0a12bc', 16) ? 07/06 14:31
→ Aungk: 抱歉,問錯了。應該是'0x12bc' 07/06 14:51
推 LuLuCow: int('0x12bc', 16) 07/06 15:19
→ LuLuCow: hex(4796) 可以轉回去 07/06 15:19
→ Aungk: 感謝大家,基本上是可以用了。 07/07 14:12