上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 36 下一页
摘要: os:ubunutu(debian)-based linux分两步:安装ipython及其依赖包sudo apt-get install ipython-notebook 安装可选的附加工具sudo apt-get install python-matplotlib python-scipy python-pandas python-sympy python-nose 启动$ ipython notebook 提示, 缺少jinja2$ sudo easy_install jinja2 阅读全文
posted @ 2014-01-10 21:10 怒杀神 阅读(5216) 评论(0) 推荐(0)
摘要: 首先,在ubuntu 10.10之后的版本中,要这样安装sudo apt-get install python-pip python-dev build-essentialsudo pip install --upgrade pipsudo pip install --upgrade virtualenv 在旧版本ubuntu中,要这样安装:sudo apt-get install python-setuptools python-dev build-essentialsudo easy_install pipsudo pip install --upgrade virtualenv... 阅读全文
posted @ 2014-01-10 20:31 怒杀神 阅读(311) 评论(0) 推荐(0)
摘要: 系统:crunch bang11+python2.7.3准备工具:sudo apt-get install python-pip python-dev build-essential 安装setuptools(easy_install)sudo pip install setuptools --no-use-wheel --upgrade 安装ipythonsudo easy_install ipython 后续配置sudo apt-get install gcc python-dev libxml2 libxml2-dev libxslt1.1 libxslt1-devsudo apt... 阅读全文
posted @ 2014-01-10 20:28 怒杀神 阅读(349) 评论(0) 推荐(0)
摘要: 001 #coding:utf-8002 import re,os,shutil,sys003 import urllib2,socket,cookielib004 from threading import Thread,stack_size,Lock005 from Queue import Queue006 import time007 from gzip import GzipFile008 from StringIO import StringIO009 010 class ContentEncodingProcessor(urllib2.BaseHandler):011 " 阅读全文
posted @ 2014-01-08 23:22 怒杀神 阅读(560) 评论(0) 推荐(0)
摘要: SGMLParserPython 默认自带 HTMLParser 以及 SGMLParser 等等解析器,前者实在是太难用了,我就用 SGMLParser 写了一个示例程序:import urllib2from sgmllib import SGMLParserclass ListName(SGMLParser): def __init__(self): SGMLParser.__init__(self) self.is_h4 = "" self.name = [] def start_h4(self, attrs): self.is_h4 = 1 def end_h4(s 阅读全文
posted @ 2014-01-08 23:08 怒杀神 阅读(2461) 评论(0) 推荐(0)
摘要: #使用import导入import my_modulemy_module.something() #out - orignal#这里修改输出 - changedreload(my_module)my_module.something() #out - changed#使用from import导入import my_module #这个需要有,否则不能reloadfrom my_module import somethingsomething() # out - orignal# 修改输出为 changed##注意这里用reload不好使,咋办##需要在第3行前面加入import my_mod 阅读全文
posted @ 2014-01-08 23:03 怒杀神 阅读(496) 评论(0) 推荐(0)
摘要: 在ipython终端时,可能临时需要使用shell命令进行简单处理;可以在shell命令前面使用 !(感叹号)比如在win7,ipython下想要使用sublime新建一个py,可以这样!subl.exe .py 阅读全文
posted @ 2014-01-08 22:38 怒杀神 阅读(535) 评论(0) 推荐(1)
摘要: 下面我们再来看看urllib模块提供的 urlretrieve() 函数。urlretrieve() 方法直接将远程数据下载到本地。1>>>help(urllib.urlretrieve)2Helpon function urlretrieveinmodule urllib:34urlretrieve(url, filename=None, reporthook=None, data=None)参数 finename 指定了保存本地路径(如果参数未指定,urllib会生成一个临时文件保存数据。)参数 reporthook 是一个回调函数,当连接上服务器、以及相应的数据块传输完 阅读全文
posted @ 2014-01-08 21:59 怒杀神 阅读(3218) 评论(0) 推荐(1)
摘要: urllib 是 python 自带的一个抓取网页信息一个接口,他最主要的方法是urlopen(),是基于 python 的 open() 方法的。下面是主要说明:1urllib.urlopen('网址')这里传入urlopen()的参数有特别说要求,要遵循一些网络协议,比如http,ftp,也就是说,在网址的开头必须要有http://这样的说明,如:urllib.urlopen('http://www.baidu.com')。要么就是本地文件,本地文件需要使用file关键字,比如 urllib.urlopen('file:nowamagic.py 阅读全文
posted @ 2014-01-08 21:19 怒杀神 阅读(876) 评论(0) 推荐(0)
摘要: Python urllib 库提供了一个从指定的 URL 地址获取网页数据,然后对其进行分析处理,获取想要的数据。下面是在 Python Shell 里的urllib的使用情况:01Python2.7.5(default, May152013,22:44:16) [MSC v.150064bit (AMD64)] on win3202Type"copyright","credits"or"license()"formore information.03>>>importurllib04>>> goo 阅读全文
posted @ 2014-01-08 20:32 怒杀神 阅读(323) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 36 下一页