随笔分类 - python
摘要:简单的抓取程序#!/usr/bin/env python#-*- coding:utf-8 -*-import sysimport urllib2wp = urllib2.urlopen('http://lvyou.baidu.com')content = wp.read()fp = open('index.html','w')fp.write(content)fp.close()通过抓取的内容可以进行内容的提取。这个还需要学习
阅读全文
摘要:读写文件 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/--># ! /usr/bin/python # -*- coding: utf8 -*- spath = " D:/download/baa.txt " f = open(spath, " w " ) # Opens file for writing.Creates this file doesn't exist. f.write( &qu
阅读全文