用户名: 密码: 忘记密码? 注册

pythonchallenge 0

作者:  时间: 2010-11-16

from urllib import request

count=range(0,255)
text=[]
file = open("e:\\1.txt","w")

for i in count:
    webfile="http://www.pythonchallenge.com/pc/def/"+"%d"%i+".html"
    print("访问"+webfile+"\n")
    try:
        web=request.urlopen(webfile)
        web_html=web.read()
        text.append( "%s"%web_html)
        file.write("第%d个文件"%i+"文件名"+webfile+"\n")
        file.write(txt)
        file.write("写入结束 \n \n")
        web.close()
    except Exception:
        print("error \n")
        web.close()
        pass

file.close()
print("结束")

待续
挑战:http://www.pythonchallenge.com/pc/def/0.html

笨啊,

很简单: 2**38  直接访问这个页面即可过关