04 2013 档案

摘要:http://www.cnblogs.com/yaksea/archive/2012/07/05/2578614.html假定需要查询name中包含s的:db.customer.find({'name': /.*s.*/i})pymongo的写法如下:rexExp = re.compile('.*s.*', re.IGNORECASE)db.customer.find({'name':rexExp })或者db.customer.find({'name': {'$regex':'.*s.*'} }) 阅读全文
posted @ 2013-04-10 12:26 道以万计 阅读(235) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/smilelance/article/details/65299501.Python正则式的基本用法import rep = re.compile(r'abc*')p.match(s)# 注意:match 只匹配 开头或结尾, 如果不想这样, 请用search# 也可以re.match(r'abc*', s)# 推荐第一种形式,compile用于加速1.1基本规则1.2重复1.2.1最小匹配与精确匹配1.3前向界定与后向界定1.4组的基本知识2.re模块的基本函数2.1使用compile加速2.2 match和searc 阅读全文
posted @ 2013-04-09 18:50 道以万计 阅读(283) 评论(0) 推荐(0)