推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
sdlearn
V2EX  ›  Python

python 怎样删除 cookie 中的指定项

  •  
  •   sdlearn · Apr 2, 2014 · 6067 views
    This topic created in 4450 days ago, the information mentioned may be changed or developed.
    比如下面这个cookie:
    <cookielib.CookieJar[ <Cookie OrigMUID=158D7FF11B506873av9A79E11A7268B0%2c3171e5f2v4cd4ebfb0b95285
    480cbd25 for .xxx.com/>, <Cookie SRCHUSR=AUTOREDIR=0&GEOVAR=&DOB=20140402 for .xxx.com/>, <Cookie _FS=NU=1 for .xxx.com/>, <Cookie _HOP= for .xxx.com/>]>
    我要删除里面的这一个:<Cookie OrigMUID=158D7FF11B506873av9A79E11A7268B0%2c3171e5f2v4cd4ebfb0b95285
    480cbd25 for .xxx.com/>该如何操作
    2 replies    1970-01-01 08:00:00 +08:00
    cbsw
        1
    cbsw  
       Apr 2, 2014
    你是用的标准库么?遇到这样的问题可以先查文档再问么?看看这里 http://www.wapm.cn/smart-questions/smart-questions-zh.html
    sdlearn
        2
    sdlearn  
    OP
       Apr 4, 2014
    使用的是cookielib模块

    这样:
    cj = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    urllib2.install_opener(opener)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3153 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 13:16 · PVG 21:16 · LAX 06:16 · JFK 09:16
    ♥ Do have faith in what you're doing.