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

          謎題詳細(xì)描述: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




          版權(quán)所有 羅明
          posted on 2008-05-09 14:32 羅明 閱讀(1342) 評論(27)  編輯  收藏 所屬分類: StudyPython
          Comments
           
          主站蜘蛛池模板: 海盐县| 徐州市| 孝感市| 横峰县| 彭水| 泾阳县| 页游| 大连市| 德令哈市| 温宿县| 土默特左旗| 万州区| 台东市| 修水县| 江门市| 钟祥市| 赤壁市| 江陵县| 黄梅县| 方山县| 修武县| 华安县| 科技| 清镇市| 山东省| 灌云县| 米泉市| 潮州市| 扎鲁特旗| 务川| 建阳市| 马山县| 湾仔区| 遵义市| 海盐县| 改则县| 定远县| 弥勒县| 文成县| 华宁县| 青阳县|