我想打印存在于但是URL文件中的行打印的文件中的内容,我得到一个错误,指出:无法使用“的urllib2”
with html as ins:
AttributeError: __exit__
张贴下面是我的代码
import urllib2
response = urllib2.urlopen('------------------')
html = response.read()
counter = 0;
with html as ins:
array = []
for line in ins:
counter = counter+1
print "cluster number is:", counter
print line
请修复您的缩进。 – Marcin 2015-02-12 02:10:50
是的..!我修正了缩进但问题仍然存在 – user3787061 2015-02-12 02:11:32
这两行仍然有错误的缩进:'用html作为ins:array = []'。请仔细检查。也许这是问题所在。 – Marcin 2015-02-12 02:14:50