|
jason52May 23, 2013
1
您是想抓图?哪里有ubb呢?
|
|
jason52May 23, 2013
2
you mean URL?
|
|
KotiyaSanaeMay 23, 2013
3
```python
import re content=""" [URL="http://www.boston.com/bigpicture/2008/10/the_sun.html"]http://www.boston.com/bigpictu....html[/URL] [url="http://www.boston.com/bigpicture/2008/10/the_sun.html"]http://www.boston.com/bigpictu....html[/url] [URL=http://www.boston.com/bigpicture/2008/10/the_sun.html]http://www.boston.com/bigpictu....html[/URL] [url=http://www.boston.com/bigpicture/2008/10/the_sun.html]http://www.boston.com/bigpictu....html[/url] [url]http://www.boston.com/bigpictu....html[/url] [URL]http://www.boston.com/bigpictu....html[/URL] """ pattern = r'.*(http://.*html?).*' pat = re.compile(pattern) pat.findall(content) ``` |
|
4
|
|
dreampufMay 23, 2013
5
import re
re.search("\\[(?:([^=]+)=([^\\]]+)|([^\\]]+))\\]([^\\[]+)\\[/(?:\\1|\\3)\\]", searchText) |
|
6
|
|
KotiyaSanaeMay 23, 2013
7
@kenneth 没太看懂你要匹配什么,是所有的boston么?那个网站不太会用……
pattern = r'.*](http://.*html?).*' ? python环境下通过…… |
|
jason52May 23, 2013
8
这种事强烈推荐用pyquery做 代码可以很简单 抓图代码就这么一点
http://dpaste.com/1196576/ |
|
jason52May 23, 2013
9
@KotiyaSanae 如果用re的话这种可以
|