python.re模块

.re:(网上摘)

import re
pattern = re.compile("forum\/(\d*)\/topic\/(\d*)")
res = pattern.search('forum/135/topic/794150').groups()
print res[0],res[1]

 

posted @ 2016-03-26 20:30  白天黑夜每日c  阅读(144)  评论(0编辑  收藏  举报