我有一个功能如下(我正在使用python2.7):
def ip_split(ip):
rtr, mask = cidr.split('/')
ip = ipaddress.ip_address(unicode(rtr))
if ip.version == 4:
n = ipaddress.IPv4Network(unicode(cidr), strict=False)
else:
n = ipaddress.IPv6Network(unicode(cidr), strict=False)
first, last = n[2], n[-2]
return n, first, last, n[1], n.network_address, mask
n_sub = "%s/%s" % ip_split('10.10.128.1/18')[3:]
Traceback (most recent call last):
File "python", line 18, in <module>
TypeError: not all arguments converted during string formatting
我收到 typeError: not all arguments 在字符串格式化期间转换。
这里有什么问题??