In <[email protected]>
[email protected] writes:
> I know the title doesn't make much sense, but I didnt know how to explain my
> problem.
> Anywho, I've opened a page's source in URLLIB
> starturlsource = starturlopen.read()
> string.find(starturlsource, '<a href="/profile.php?id=')
> And I used string.find to find a specific area in the page's source.
> I want to store what comes after ?id= in a variable.
> Can someone help me with this?
starturlsource = starturlopen.read()
match_string = '<a href="/profile.php?id='
match_index = string.find(starturlsource, match_string)
if match_index != -1:
url = starturlsource[match_index + len(match_string):]
else:
print 'not found'
--
John Gordon A is for Amy, who fell down the stairs
[email protected] B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list