# 常用操作方法 # bit_lenth() 获取十进制转化成二进制的最小位数 i = 42 i1 = 300 print(i.bit_length()) print(i1.bit_length())
输出
6 9