base = [str(x) for x in range(10)] + [chr(x) for x in range(ord('A'), ord('A') + 6)] # ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'] def dec2bin(string_num): '''十进制转换为 二进制''' num = int(string_num) # 转换为 整数 mid = []…