空格被忽略(即,您的表达式有效
DukeWann),因此您需要确保那里有一个空格:
regex = re.compile(r'''Duke[ ] # First name followed by a spaceWann #Last Name''', re.VERBOSE | re.IGNORECASE)
参见http://docs.python.org/2/library/re.html#re.VERBOSE

空格被忽略(即,您的表达式有效
DukeWann),因此您需要确保那里有一个空格:
regex = re.compile(r'''Duke[ ] # First name followed by a spaceWann #Last Name''', re.VERBOSE | re.IGNORECASE)
参见http://docs.python.org/2/library/re.html#re.VERBOSE