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
  • 115,751
  • 26
  • 228
  • 437

0 Answers0