随笔分类 -  Python

摘要:1、获取web页面#coding:utf-8import sys,urllib2req=urllib2.Request(sys.argv[1])fd=urllib2.urlopen(req)while 1: data=fd.read(1024) if not len(data): ... 阅读全文
posted @ 2014-09-30 12:28 我是zero 阅读(289) 评论(0) 推荐(0)
摘要:#coding:utf-8import urllib #导入模块print dir(urllib) #查看urllib方法print help(urllib.urlopen) #查看帮助文档url="http://www.baidu.com" #定义网址html=urllib.urlop... 阅读全文
posted @ 2014-09-29 13:29 我是zero 阅读(346) 评论(0) 推荐(0)
摘要:1、os.path os.path.split():os拆分路径,返回 一个tuple,第一个为路径,第二个为文件名; os.path.basename():只获取文件名; os.path.dirname():只获取路径; os.path.splitext():将路径,文件名,扩展名分开,并... 阅读全文
posted @ 2014-09-22 16:50 我是zero 阅读(484) 评论(0) 推荐(0)