我是Python CGI脚本的新手。我想在Python中读取cookie。我尝试了以下代码:
from urllib2 import Request, build_opener, HTTPCookieProcessor, HTTPHandler
import cookielib
#Create a CookieJar object to hold the cookies
cj = cookielib.CookieJar()
#Create an opener to open pages using the http protocol and to process cookies.
opener = build_opener(HTTPCookieProcessor(cj), HTTPHandler())
#Check out the cookies
print "the cookies are: "
for cookie in cj:
print cookie
但是,我只看到了“cookies are:”这个消息。
我做错了什么吗?