2024-03-29 06:02:32 发布
网友
好吧,所以我们都知道他们有很多工具可以告诉你一个网站是上是下还是可用,但是我想做一个工具来检查网站中的页面。例子: 网站www.Example.com是向上的,但不向上翻页www.Example.com/test.html存在吗?你知道吗
游戏 cpanel公司 注册 指数 例子 加入我们
我的程序输出应该是(如果是成批的): 按1开始 启动。。。 联机页面: -cpanel公司 -游戏 -细骨 等。。。 如果不能在批处理或python中完成,那么可以通过哪些其他语言完成? 非常感谢:)
检查winhttpjs.bat-它会将http请求的http响应代码设置为错误级别:
@echo off call winhttpjs.bat http://google.com -saveto con >nul if errorlevel 200 if not errorlevel 300 echo site is available
我想这就是你想要的:
import urllib2 u = 'http://www.google.com/' pages = open('pages.txt', 'r').readlines() for page in pages: url = u+page try: req = urllib2.urlopen(url) except urllib2.HTTPError as e: if e.code == 404: print url+" does not exists" else: print url+" exists"
使用包含以下内容的pages.txt文件进行测试:
pages.txt
search page plus signin account security lol about someotherpage.html
检查winhttpjs.bat-它会将http请求的http响应代码设置为错误级别:
我想这就是你想要的:
使用包含以下内容的
pages.txt
文件进行测试:相关问题 更多 >
编程相关推荐