python使用urllib2抓取网页时的错误处理,pythonurllib2,try: urlf
python使用urllib2抓取网页时的错误处理,pythonurllib2,try: urlf
try: urlfile = urllib2.urlopen('http://sebsauvage.net/nonexistingpage.html')except urllib2.HTTPError, exc: if exc.code == 404: print "Not found !" else: print "HTTP request failed with error %d (%s)" % (exc.code, exc.msg)except urllib2.URLError, exc: print "Failed because:", exc.reason
相关内容
- python计算代码执行时间,python计算代码,import times
- python使用xmlproc验证xml格式是否符合DTD定义,xmlprocdtd,
- python线程池实现,python线程池,python原生包中没有
- python的SIGIO handler,sigiohandler,On Linux, us
- python写的一个骰子程序,python写骰子程序,import rando
- python中RGB和HSL的相互转换,pythonrgbhsl,def HSL_to_R
- Python从int继承实现枚举,pythonint枚举,枚举可以给数字一
- python使用urllib2模拟http post,pythonurllib2,使用urllib2.ur
- python在windows下执行子进程时隐藏命令行窗口,python窗口
- python正则表达式判断文本中是否有中文,python正则表达
评论关闭