返回双连续字母的单词

ita*_*oot 2 python regex

我正在尝试制作一个python程序来返回具有双连续字母的单词(例如,门,球,地板).我的代码到现在为止如下所示,但它将文件中的所有单词分成两个字母的部分:

def text_processing( file_location ):
    import re
    file_variable = open( file_location )
    lines = file_variable.read()
    print lines

    double_letter = re.compile('[A-Z]{2,2}', re.IGNORECASE)
    double_letter_list = double_letter.findall(lines)

    print double_letter_list
Run Code Online (Sandbox Code Playgroud)

use*_*188 6

试试这个正则表达式: r"\w*(\w)\1\w*"