このコードを使用して、IPアドレスで組織を取得します
import urllib
import lxml.html as lh
req= urllib.Request("http://www.ip-address.com/ip_tracer/157.123.22.11", headers={'User-Agent' : "Magic Browser"})
html = urllib.urlopen(req).read()
doc = lh.fromstring(html)
print (''.join(doc.xpath('.//*[@class="odd"]')[-1].text_content().split()))
私のpythonは3.2.3です。
Traceback (most recent call last):
File "ext.py", line 3, in <module>
req= urllib.Request("http:// www.ip-address.com/ip_tracer/157.123.22.11", headers={'User-Agent' : "Magic Browser"})
AttributeError: 'module' object has no attribute 'Request'
それを解決する方法。ありがとう、