0
import urllib.request, urllib.parse, urllib.error

fhand = urllib.request.urlopen('http://data.pr4e.org/intro-short.txt')

counts = dict()
for line in fhand:
    words = line.decode().split()
    for word in words:
        counts[word] = counts.get(word, 0) + 1
print(counts)

Traceback

And the python version that I'm using is 3.8.5

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376

0 Answers0