2
我正在使用ActivePython 2.5.1和cookielib包来检索网页。如何显示特定的cookie?
我想从cookiejar,而不是整个事情显示给定的cookie:
#OK to display all the cookies
for index, cookie in enumerate(cj):
print index, ' : ', cookie
#How to display just PHPSESSID?
#AttributeError: CookieJar instance has no attribute '__getitem__'
print "PHPSESSID: %s" % cj['PHPSESSID']
我敢肯定,这很简单,但google搜索这没有返回样本。
谢谢。
感谢您的提示。 – Gulbahar 2010-04-15 15:34:35