CODE:
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)
ERROR:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined
You can also try in Python 3:
Try pls:
You've imported
urlopen
directly, so you should refer to it like that rather than viaurllib
:For your case: