instead of reading cookies (plan B)

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Dec 11 17:39:59 EST 2007


En Tue, 11 Dec 2007 17:34:50 -0300, Vincent Hirth <vhirth at vircas.com>  
escribi�:

> I was just thinking of an alternative to reading cookies directly - at  
> least
> in my case. What if I create a PHP file that contains the cookies in 2
> lines, such as this?
>

(To make it more clear:)

--- begin of file ---
Myusername
Mypassword
--- end of file ---

> What would the python script look like if I wanted to open the file and  
> put
> the 2 values in variables?

 from __future__ import with_statement

with open(filename, "r") as f:
   username = f.readline().strip()
   password = f.readline().strip()

The above answers your specific question, but I don't see any relation  
with cookies or PHP.

-- 
Gabriel Genellina




More information about the Python-list mailing list