文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>re.findall---find letters

re.findall---find letters

时间:2010-01-24  来源:angelia_liu

re.findall(pattern, string[, flags])¶

Return all non-overlapping matches of pattern in string, as a list of strings. The string is scanned left-to-right, and matches are returned in the order found. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result unless they touch the beginning of another match.

     findall 匹配串中所有符合条件的串,并以LIST的形式返回。以下这个程序用来匹配前后(只)有三个大写字母的小写字母。如“sEFCgETYt”中的g.

'''This program use for select the lowcharacter which have three capital letters before and after
the the lower case letters, such as 'ABCdEFG'.'''
import os
import sys
import re

if __name__=='__main__':
    f=open("E:\pythonchallenge\letters\letters.txt","r")
    src=f.read()
    m=''.join(re.findall('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]',src))
    print m


相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载