0

これが私のコードです

from pox.lib.addresses import IPAddr
def ip_atoi(st):
"""
function to convert ip address to integer value
"""
  st=st.split(".")
  return int("%02x%02x%02x%02x"%(int(st[0]),int(st[1]),int(st[2]),int(st[3])),16)
  1. poxコントローラーでこのスクリプトを実行すると、エラーが発生します

    AttributeError: 'IPAddr' object has no attribute 'split'
    
4

1 に答える 1

2

その理由はst、文字列ではなくIPAddrオブジェクトだからです。代わりにやりたいことは次のとおりです。

st = str(st).split(".")
于 2016-05-18T13:19:47.250 に答える