【发布时间】:2009-07-28 09:19:45
【问题描述】:
我正在使用 Python 2.6,并且从 re.sub() 得到 [我认为是] 意外的输出
>>> re.sub('[aeiou]', '-', 'the cat sat on the mat')
'th- c-t s-t -n th- m-t'
>>> re.sub('[aeiou]', '-', 'the cat sat on the mat', re.IGNORECASE)
'th- c-t sat on the mat'
如果这个输出是预期的,它背后的逻辑是什么?
【问题讨论】: