我需要帮助来修复此代码:
import urllib.request,urllib.parse,urllib.error
fhand = urllib.request.urlopen("http://data.pr4e.org//romeo.txt")
counts = dict ()
for line in fhand:
lines = line.decode.split()
for words in lines:
counts[words] = counts.get(words,0)+1
print(counts)
运行此代码时出现此错误:
C:\Users\g.p\AppData\Local\Programs\Python\Python37-32>py urllib2.py
Traceback (most recent call last):
File "urllib2.py", line 5, in <module>
lines = line.decode.split()
AttributeError: 'builtin_function_or_method' object has no attribute 'split'
答案 0 :(得分:2)