python脚本检查网页能否打开
2016-01-24 14:16
337 查看
批量判断网站能否访问,可以使用urllib的getcode()方法
运行结果:
参考:
http://stackoverflow.com/questions/2792650/python3-error-import-error-no-module-name-urllib
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from urllib.request import urlopen url = 'http://www.baidu.com' resp = urlopen(url) code = resp.getcode() print('the result is :', code)
运行结果:
参考:
http://stackoverflow.com/questions/2792650/python3-error-import-error-no-module-name-urllib
相关文章推荐
- python进阶学习三——第四天
- 21行python代码实现拼写检查器
- 使用py2exe将python3程序转换成exe文件
- [Leetcode] 98. Validate Binary Search Tree @python
- python序列通用操作符
- Python&Numpy:tile函数
- 【机器学习实验】学习Python来分类现实世界的数据
- MySQL Schema设计(三)利用Python操作Schema
- [Leetcode]97. Interleaving String @python
- python3.5模拟登陆
- Python是朵两生花 (__str__ __repe__ is) 讲的很清楚
- Python--逻辑/循环/异常/编码
- python 11期 第六天
- python通过163邮箱发送邮件
- python通过163邮箱发送邮件
- python优秀网友学习笔记推荐
- python日志记录
- 使用python发送邮件
- python实现的二分查找
- Python 快速入门(下) - 使用Web2Py框架搭建网站