为什么在导入包时,我的Atom编辑器会给出一个回溯(traceback)?

3 浏览
0 Comments

为什么在导入包时,我的Atom编辑器会给出一个回溯(traceback)?

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)

出现错误

我使用的Python版本是3.8.5。

0