Python error when using urllib.open

后端 未结 3 1868
逝去的感伤
逝去的感伤 2020-12-09 08:58

When I run this:

import urllib

feed = urllib.urlopen(\"http://www.yahoo.com\")

print feed

I get this output in the interactive window (Py

3条回答
  •  余生分开走
    2020-12-09 09:46

    In python 3.0:

    import urllib
    import urllib.request
    
    fh = urllib.request.urlopen(url)
    html = fh.read().decode("iso-8859-1")
    fh.close()
    
    print (html)
    

提交回复
热议问题