cookie

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Aug 28 19:32:35 CEST 2004


In <mailman.2553.1093667904.5135.python-list at python.org>, Ajay wrote:

> 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.

It's no difference if you bind the string to a name or assign it directly,
it's the contents of the string:

>>> import Cookie
>>> c = Cookie.SimpleCookie()
>>> c["test"] = "spaceless"
>>> print c
Set-Cookie: test=spaceless;
>>> c["test"] = "not spaceless"
>>> print c
Set-Cookie: test="not spaceless";

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list