[Python] python基本进制转换代码 →→→→→进入此内容的聊天室

来自 , 2020-08-12, 写在 Python, 查看 116 次.
URL http://www.code666.cn/view/eb30fa42
  1. # Parsing string with base into a number is easy  
  2. num = int(str, radix)  
  3.  
  4. # We have to write our own function for outputting to string with arbitrary base  
  5. def itoa(num, radix):  
  6.   result = ""  
  7.   while num > 0:  
  8.     result = "0123456789abcdefghijklmnopqrstuvwxyz"[num % radix] + result  
  9.     num /= radix  
  10.   return result  
  11. #//python/4556

回复 "python基本进制转换代码"

这儿你可以回复上面这条便签

captcha