Chinaunix首页 | 论坛 | 博客
  • 博客访问: 482210
  • 博文数量: 108
  • 博客积分: 25
  • 博客等级: 民兵
  • 技术积分: 1134
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-29 19:43
文章分类

全部博文(108)

文章存档

2016年(10)

2015年(9)

2014年(73)

2013年(16)

我的朋友

分类: Python/Ruby

2014-04-10 12:49:22

最近忙的很,暂时找点东西看下。不想干活。
search(string[pos[endpos]])

Scan through string looking for a location where this regular expression produces a match, and return a corresponding  instance. Return None if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.

The optional second parameter pos gives an index in the string where the search is to start; it defaults to 0. This is not completely equivalent to slicing the string; the '^' pattern character matches at the real beginning of the string and at positions just after a newline, but not necessarily at the index where the search is to start.

The optional parameter endpos limits how far the string will be searched; it will be as if the string is endpos characters long, so only the characters from pos to endpos - 1 will be searched for a match. If endpos is less than pos, no match will be found, otherwise, if rx is a compiled regular expression object, rx.search(string, 0, 50) is equivalent to rx.search(string[:50], 0).

search模块

阅读(689) | 评论(0) | 转发(1) |
0

上一篇:看python re dos的一些知识

下一篇:linux memory

给主人留下些什么吧!~~