问答详情
源自:3-1 urllib基本用法

req.add_header报错

>>> req.addheader("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0")

Traceback (most recent call last):

  File "<pyshell#3>", line 1, in <module>

    req.addheader("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0")

AttributeError: 'HTTPResponse' object has no attribute 'addheader'


提问者:不想再做设计的阿碳 2016-08-26 16:20

个回答

  • 秋名山车神
    2016-08-26 16:57:01

    add和header中间有一个下划线