getting a value from a web-page

Mark Carter cartermark46 at
Thu Sep 25 10:49:31 CEST 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.

> And a value from an excel located in a web-server? (Sheet1!cell A1)

Do you mean an excel file located on your server, or somebody else's
server? If it is on your server, you could manipulate the file
directly using Mark Hammond's excellent win32all:

A typical piece of python code to manipulate Excel is:

# this example starts Excel, creates a new workbook, 
# puts some text in the first and second cell
# closes the workbook without saving the changes
# and closes Excel.  This happens really fast, so
# you may want to comment out some lines and add them
# back in one at a time ... or do the commands interactively

from win32com.client import Dispatch

xlApp = Dispatch("Excel.Application")
xlApp.Visible = 1
xlApp.ActiveSheet.Cells(1,1).Value = 'Python Rules!'
xlApp.ActiveWorkbook.ActiveSheet.Cells(1,2).Value = 'Python Rules 2!'
del xlApp

# raw_input("press Enter ...")

More information about the Python-list mailing list