我想打印存在於但是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