通过本文主要向大家介绍了python 16进制,python 二进制,python 十六进制,python八进制,python 16进制转2进制等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
本文实例讲述了python基本进制转换的方法。分享给大家供大家参考。具体如下:
# Parsing string with base into a number is easy num = int(str, radix) # We have to write our own function for outputting to string with arbitrary base def itoa(num, radix): result = "" while num > 0: result = "0123456789abcdefghijklmnopqrstuvwxyz"[num % radix] + result num /= radix return result</div>
希望本文所述对大家的Python程序设计有所帮助。
</div>
