[Tutor] Cookielib - CookieJar objects
Peter Szinek
peter at rt.sk
Wed Jun 29 18:39:11 CEST 2005
Hello Denise,
How about this:
myjar = cookielib.CookieJar()
for cookie in myjar:
print cookie.value
In this case the above code should print a single 'B'.
HTH,
Peter
Liam Clarke wrote:
> Hi Denise,
>
> Have you tried 'print myjar.value'?
>
> Regards,
>
> Liam Clarke
> On 6/29/05, *D. Hartley* <denise.hartley at gmail.com
> <mailto:denise.hartley at gmail.com>> wrote:
>
> Hi everyone! Just a quick question about cookie jars:
>
> when I create a myjar = cookielib.CookieJar(), and go to a website to
> get the particular cookie, I get something like this in return:
>
> <cookielib.CookieJar [Cookie(version=0, name='info', value='B',
> port=None, port_specified=False, domain='.pythonchallenge.com',
> domain_specified=True, domain_initial_dot=True, path='/',
> path_specified=True, secure=False, expires=1120610689, discard=False,
> comment=None, comment_url=None, rest={})]>
>
> or, if I do print myjar, this: <cookielib.CookieJar[<Cookie info=B
> for .pythonchallenge.com/>]> .
>
> Now, if I wanted to pull out just the value from the cookie ( i.e., "B"
> in this particular case, labelled as "cookie info" in the print
> statement and 'value=' in the cookiejar instance), how could I do
> that?
>
> I have tried looking through the documentation and its examples, tried
> __doc__ and help() and dir() and can't find it. Perhaps I'm just
> missing something, but does anyone know?
>
> Thanks!
>
> ~Denise
> _______________________________________________
> Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
> http://mail.python.org/mailman/listinfo/tutor
>
>
>
>
> --
> 'There is only one basic human right, and that is to do as you damn well
> please.
> And with it comes the only basic human duty, to take the consequences.'
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list