import urllib
import re
def main():
url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="
url_to = url + "12345"
#url_to = url + "46059" # After get new messages.
while 1:
source = urllib.urlopen(url_to)
data = source.read()
number = re.findall("nothing is ([0-9]+)", data)
if number:
url_to = url + "".join(number)
print url_to
else:
break
print data
if __name__ == "__main__":
main()
'Coding > Python 삽질기' 카테고리의 다른 글
http://www.pythonchallenge.com...Level5 (0) | 2010.12.13 |
---|---|
http://www.pythonchallenge.com...Level3 (0) | 2010.12.12 |
http://www.pythonchallenge.com...Level2 (0) | 2010.12.06 |