[Tutor] Read same instance twice
Øyvind
python at kapitalisten.no
Mon Oct 27 21:03:19 CET 2008
Hello.
I am trying to gather some information from a webpage:
side = urlopen("http://www.website.no")
rawstr = r"""spy.target="_top">(.*?)$"""
rawstr2 = r"""spy.target2="_top">(.*?)$"""
compile_obj = re.compile(rawstr, re.IGNORECASE| re.MULTILINE| re.VERBOSE
| re.UNICODE)
compile_obj2 = re.compile(rawstr2, re.IGNORECASE| re.MULTILINE|
re.VERBOSE | re.UNICODE)
liste = self.compile_obj.findall(side.read())
liste = self.compile_obj2.findall(side.read())
It works like a dream getting the first info, but the second doesn't work.
The instance is empty.
I have tried
side2 = side
side2 = side[:]
side2 = deepcopy(side)
side2 = copy(side)
and even side2 = cStringIO.StringIO(side)
But nothing works.
How can I easiest pick up more information from the site without opening
it more than once?
Thanks
--
This email has been scanned for viruses & spam by Domenebutikken - www.domenebutikken.no
Denne e-posten er sjekket for virus & spam av Domenebutikken - www.domenebutikken.no
More information about the Tutor
mailing list