page = ... contents of some web page ...
start_link = page.find('<a href=')
start_quote = page.find('"',start_link)
end_quote=gape.find('"',start_quote+1)
url = page[start_quote+1:end_quote]
print url # first url on the page
# repeat
page = page[end_quote:] # page 값을 update
start_link = page.find('<a href=')
start_quote = page.find('"',start_link)
end_quote=gape.find('"',start_quote+1)
url = page[start_quote+1:end_quote]
print url # second url on the page
page = page[end_quote:] # page 값을 update
start_link = page.find('<a href=')
start_quote = page.find('"',start_link)
end_quote=gape.find('"',start_quote+1)
url = page[start_quote+1:end_quote]
print url # third url on the page
.
.
.
'Computers > Language python' 카테고리의 다른 글
if statement (0) | 2012.03.14 |
---|---|
procedure (0) | 2012.03.14 |
web crawler - extract link (0) | 2012.03.14 |
파이썬 문자열 string find (0) | 2012.03.14 |
파이썬 문자열 substring / slicing (0) | 2012.03.14 |