V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  lyxint  ›  全部回复第 6 页 / 共 8 页
回复总数  158
1  2  3  4  5  6  7  8  
@kojp 正则比单纯的字符串操作慢, beatifulsoup那就更慢了. beautifulsoup累死累活建了dom树, 你只取<p>和</p>之间的内容, 太浪费了.

真想用什么库, 那就HTMLParser (beautifulsoup也用了), 很简单.
2012-01-12 00:16:32 +08:00
回复了 shunai 创建的主题 程序员 linux 下写php什么编辑器比较爽?
vim, aptana, komodo edit
index.html是wget http://news.sina.com.cn/ 存到本地的
@fature 字符串下标操作比re要慢??? 不可能的.

让数据说话.

http://gist.github.com/1595083.js?file=test.py

http://gist.github.com/1595083.js?file=result
<script src="https://gist.github.com/1595083.js"> </script>
用张教主的txt_wrap_by_all
def txt_wrap_by(begin, end, html):
if not html:
return ''
start = html.find(begin)
if start >= 0:
start += len(begin)
end = html.find(end, start)
if end >= 0:
return html[start:end].strip()

def txt_wrap_by_all(begin, end, html):
if not html:
return ''
result = []
from_pos = 0
while True:
start = html.find(begin, from_pos)
if start >= 0:
start += len(begin)
endpos = html.find(end, start)
if endpos >= 0:
result.append(html[start:endpos].strip())
from_pos = endpos+len(end)
continue
break
return result

ps = txt_wrap_by_all('<p>', '</p>', html)
python的要加re.DOTALL这个flag, 不然会漏结果
2012-01-11 01:09:48 +08:00
回复了 popoer 创建的主题 iDev 公司要研发iPad版OA客户端了,被领导指定为负责人,各种求建议
看得我云里雾里啊,好多名词。
2012-01-07 21:27:17 +08:00
回复了 em91 创建的主题 macOS secureCRT过期了,mac下还有啥可以用rz命令么
netcat
2012-01-03 22:54:37 +08:00
回复了 daqing 创建的主题 程序员 Rabel - Project Babel 2 on Rails - 预览版上线
@daqing 那应该是不推荐, 而不是不支持
2012-01-03 22:40:20 +08:00
回复了 daqing 创建的主题 程序员 Rabel - Project Babel 2 on Rails - 预览版上线
不支持windows是何来的? rails不能跑在windows上吗?
2012-01-03 22:24:12 +08:00
回复了 gujiaxi 创建的主题 Linux 你觉得哪个Linux发行版的Logo最好看呢?
2012-01-03 22:22:24 +08:00
回复了 Livid 创建的主题 Project Babel 新功能 - 特别关注
怎么知道谁follow了自己啊?
2012-01-03 22:01:02 +08:00
回复了 gujiaxi 创建的主题 Linux 你觉得哪个Linux发行版的Logo最好看呢?
Linux Distro Logos Collections

http://fossilet.users.sourceforge.net/gnulinux/distro-logos.en.html

redhat的红帽子logo挺酷的呀, http://fossilet.users.sourceforge.net/images/dl/redhat.png

BSD系列的也都很酷
2012-01-03 18:02:34 +08:00
回复了 gujiaxi 创建的主题 Linux 你觉得哪个Linux发行版的Logo最好看呢?
没人觉得redhat很酷么
2012-01-01 11:02:22 +08:00
回复了 GordianZ 创建的主题 V2EX 2012 New Year's resolution 新年计划
1. 去看看大地上的事
2. 能多看一些书籍
3. 锻炼身体
2012-01-01 00:33:48 +08:00
回复了 bcxx 创建的主题 天黑以后 20120101 午夜俱乐部
新年快乐大家:-)
1  2  3  4  5  6  7  8  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1016 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 35ms · UTC 20:28 · PVG 04:28 · LAX 13:28 · JFK 16:28
Developed with CodeLauncher
♥ Do have faith in what you're doing.