urllib 模块错误启动脚本 python 2.7.13

urllib module errors launching script with python 2.7.13

我想通过 url 和 urllib 启动脚本来获取文件,但我总是遇到一系列错误:

我查看了文档并说某些内容已被弃用,但我找不到正确的语法。

import urllib

fhand = urllib.urlopen('http://www-dr-chuck.com/page1.htm')
for line in fhand:
    print line.strip()

你的URL是错误的。

http://www-dr-chuck.com/page1.htm

我觉得应该是

http://www.dr-chuck.com/page1.htm

www 之后应该有一个点 .,而不是破折号 -