# 整型转换成二进制 def int2bin(x): str_lst = [] while x!= 0: mod = x%2 str_lst += str(mod) x //= 2 return str_lst[::-1] # ip地址以分隔符为分割,逐个转换成二进制 def ip2bin(ip): bin_rst = [] for x in ip.split('.'): x = int(x) bin_len = len(int2bin(x)) #小于8位则补齐 i...