cookie

John J. Lee jjl at pobox.com
Sat Aug 28 13:27:07 EDT 2004


Ajay <abra9823 at mail.usyd.edu.au> writes:
[...]
> i believe you. i didn't think it would make a difference. and i agree that
> the Cookie module preserves quotes across the parse->output cycle
> my question is
> >>> import Cookie
> >>> c = Cookie.SimpleCookie()
> >>> c["test"]= "blah"
> >>> print c
> Set-Cookie: test=blah;
> >>> c["test"] = "blah" + "testing"
> >>> print c
> Set-Cookie: test=blahtesting;
> >>> str = "testing blah"
> >>> c["test"] = str
> >>> print c
> Set-Cookie: test="testing blah";
> 
> why does the final print statement have the quotes. Note i haven't put
> str='"testing blah"'. if i had done that i would understand the quotes
> there.

Does the following help?

Python 2.4a2 (#5, Aug  5 2004, 22:07:01)
[GCC 2.95.4 20011002 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Cookie
>>> c = Cookie.SimpleCookie()
>>> c["test"] = "testingblah"
>>> print c
Set-Cookie: test=testingblah;
>>> c["test"] = "testing blah"
>>> print c
Set-Cookie: test="testing blah";
>>>


John



More information about the Python-list mailing list