Follow the URL chain to get the result (the chain may contain over 300 URLs......)

谜题详细描述:http://www.pythonchallenge.com/pc/def/linkedlist.php

Python解决方案:
import urllib

nothing 
= "12345"
ii 
= 1
while ii<401:
  source 
= urllib.urlopen("http://www.pythonchallenge.com" 
    
+ "/pc/def/linkedlist.php?nothing="+nothing).read()
  nothing
=filter(str.isdigit, source)

  
print nothing
  
if source != "and the next nothing is " + nothing:
    
print "source is not: and the next nothing is " + nothing
    
print "source is: " + source
    nothing 
= raw_input("select which number?")
    
print "you set " + nothing + " as nothing"
  ii
+=1




版权所有 罗明
posted on 2008-05-09 14:32 罗明 阅读(1307) 评论(27)  编辑  收藏 所属分类: StudyPython
Comments

只有注册用户登录后才能发表评论。


网站导航: