草庐IT

addinfourl

全部标签

python - 回溯 : AttributeError:addinfourl instance has no attribute '__exit__'

fromurllibimporturlopenwithurlopen('https://www.python.org')asstory:story_words=[]forlineinstory:line_words=line.split()forwordsinline_words:story_words.append(word)错误信息:Traceback(mostrecentcalllast):File"",line1,inAttributeError:addinfourlinstancehasnoattribute'__exit__'我不明白上面的代码有什么问题以及如何解决?系统信