bit.length()

-bit.length(): age = 10 r = age.bit_length() #bit.length()表示这个数字的二进制 至少 用几位数来表示print(r)

    推荐阅读