Python elegant inverse function of int(string,base)

后端 未结 11 880
谎友^
谎友^ 2020-11-28 06:01

python allows conversions from string to integer using any base in the range [2,36] using:

int(string,base)

im looking for an elegant inver

11条回答
  •  一个人的身影
    2020-11-28 06:22

    If you use Numpy, there is numpy.base_repr.

    You can read the code under numpy/core/numeric.py. Short and elegant

提交回复
热议问题