Friday,July-30th
 

以前写了个python脚本,下载interfacelift.com的壁纸的

#!/usr/bin/python2.6  
# -*- coding: utf-8 -*-
import sys
import os
import string
import urllib2
import re

__author__ = "kaoyu"
__date__ = "$2010-4-6 13:25:33$"



def getWallpaper(x, y, start, pages):
    """To get wallpapers from interfaceLift.com"""

阅读全文>>

 

urllib2.URLError: <urlopen error (10060, 'Operation timed out')>

urllib2.URLError: <urlopen error (10060, 'Operation timed out')>

 

 

python正则表达式

在CU上看到一贴,备忘

问:

 s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'

用正则表达式取出 前后字母相同的数据 结果如下:

111,  ddd,

谢谢~

 

答:

result = [re.findall(r'^(.+)(.+?)(\1)$',i)[0][1] for i in s.split(',') if re.match(r'^(.+)(.+?)(\1)$',i)]
print result
 
原帖地址
http://bbs3.chinaunix.net/thread-1603771-1-1.html