代码:
import networkx as net
from urllib.request import urlopen
def read_lj_friends(g, name):
# fetch the friend-list from LiveJournal
response=urllib.urlopen('http://www.livejournal.com/misc/fdata.bml?user='+name)
错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined
urllib
是标准库的一部分。您无需安装不同的库urllib3
。此外,urlopen
返回类似文件对象的内容,而不是HTML。 - interjay