本文實(shí)例講述了python基本進(jìn)制轉(zhuǎn)換的方法。分享給大家供大家參考。具體如下:
# Parsing string with base into a number is easynum = int(str, radix)# We have to write our own function for outputting to string with arbitrary basedef itoa(num, radix): result = "" while num > 0: result = "0123456789abcdefghijklmnopqrstuvwxyz"[num % radix] + result num /= radix return result
希望本文所述對大家的Python程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選