MSIE6 Python Question
Kevin T. Ryan
kevryan0701 at yahoo.com
Sun May 23 23:18:21 EDT 2004
Ralph A. Gable wrote:
> I'm a newbie at this but I need to control MSIE6 using Python. I have
> read the O'Reilly win32 python books and got some hints. But I need to
> Navigate to a site (which I know how to do) and then I need to get at
> the source code for that site inside Python (as when one used the
> View|Source drop down window). Can anyone point me to some URLs that
> would help out? Or just tell me how to do it? I would be very
> grateful.
I'm not sure why you need to go through IE, but maybe this will get you into
the right direction:
>>> import urllib
>>> f = urllib.urlopen('http://www.python.org')
>>> f.readline()
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n'
>>> f.readline()
' "http://www.w3.org/TR/html4/loose.dtd" >\n'
>>>
You could do:
for line in f:
process(line)
just like you can with a file. Check the urllib, urllib2, and other related
modules (maybe httplib). Hope that helps.
More information about the Python-list
mailing list