getting a value from a web-page

Xavier Martínez xavim at fqingenieria.es
Thu Sep 25 05:39:46 EDT 2003


> > Is it possible to get a row from a text-file? This text-file is located 
> > in a web page.
> 
> I'm not sure exactly what it is you are trying to achieve, but you
> might be able to use the urllib() module to download the file. I
> recall the existence of a module which can efficiently extract
> specified rows from a text file - but, alas, I don't recall its name.
> But it wouldn't be strictly necessary, anyway.

Have a look at 'linecache' module.  This will only work with a 
local file, though, so you need to retrieve the file, see 
urllib.urlretrieve() at:

http://www.python.org/doc/current/lib/module-urllib.html

See also:
http://www.python.org/doc/current/lib/module-linecache.html
and:
http://gnosis.cx/TPiP/chap1.txt  (a chapter of David Mertz's book
'Text Processing in Python').






More information about the Python-list mailing list