Ben Hearsum bhearsum at
Sun Jul 27 22:07:25 CEST 2003

I'm confused about the way Cookie.load outputs cookies. Is there a way I
can tell it to give me the value of a key?

I set my cookie like this:

mycookie = Cookie.SimpleCookie()
mycookie['key'] = "foobar"

print mycookie
print("Content-Type: text/html\n\n")

Now, to retrieve it, the documentation says I parse the HTTP_COOKIE
environment variable. Makes sense to me. But when I print it out I get
"Set-Cookie: key=foobar;". I was thinking of parsing it with cgi.parse_qs,
but even if i do print(mycookie.output(header="")) there's still a ; at
the end of the cookie.

Here's what I use to print them out:

cookie = Cookie.SimpleCookie()

print("Content-Type: text/html\n\n")



Can anyone provide any advice?

- Ben Hearsum

More information about the Python-list mailing list