我写了一个小的Python片段,它可以抓取一个源,并将其打印出来。当我运行代码时,源中的某些内容会触发错误消息,如我所提出的问题所示。以下是错误时完整的控制台输出:
> Traceback (most recent call last):
> File "/home/vijay/ffour/ffour5.py",
> line 20, in <module>
> myfeed() File "/home/vijay/ffour/ffour5.py", line
> 15, in myfeed
> sys.stdout.write(entry["title"]).encode('utf-8')
> AttributeError: 'NoneType' object has
> no attribute 'encode'