摘要:
6-11.转换。(a)创建一个从整型到IP地址的转换,如下格式:www.xxx.yyy.zzz。(b)更新你的程序,使之可以逆转换。【答案】(a)代码如下:Input_number = abs(int(raw_input('Please input a number ...')))x3 = x2 = x1 = x0 = 0x3 = Input_number / (256 ** 3)if x3 > 255: tmp = x3 x3 = 255else: tmp = x3x2 = (Input_number - 256 ** 3 * tmp) / (256 ** 2)x1 = 阅读全文