Ruby's Louvre

每天学习一点点算法

导航

2011年6月27日 #

python学习笔记—— 函数

摘要: 〈p>读取远程页面from urllib import urlretrievedef printFile(url): f = open(url) for line in f: if line.strip(): print line f.close()def loadFile(url=r'http://www.idkin.com/contact.html', process=printFile): try: fileName = urlretrieve(url,'tmp.html')[0] print(fileName) except BaseExcepti 阅读全文

posted @ 2011-06-27 14:14 司徒正美 阅读(1500) 评论(0) 推荐(0) 编辑