题解 | #整数与IP地址间的转换#
整数与IP地址间的转换
https://www.nowcoder.com/practice/66ca0e28f90c42a196afd78cc9c496ea
def tran_ip(in_intip): x=bin(int(in_intip))[2:].zfill(32) new_ip='' for i in range(0,len(x),8): new_ip+=str(int(x[i:i+8],2))+'.' return new_ip.strip('.') while True: try: print(int(''.join(map(lambda x:bin(int(x))[2:].zfill(8),input().split('.'))),2)) print(tran_ip(input())) except: break