那么,我有一个句子如下:
sent = "My name is xyz and I got my name from my parents. My email address is nomail@gmail.com"
我想得到这个句子中所有以元音开头的单词,比如是,我是,是。到目前为止,这是我的正则表达式,它不起作用。你知道吗
re.findall('^(aeiou|AEIOU)[\w|\s].',sent)
这就是我得到的结果
['. ', '..', '.s', '@g', '.c']
任何帮助都将不胜感激。你知道吗
Tags:
首先,括号不平衡,没有检查单词边界。试试这个:
可以将
re.findall
与re.I
一起使用:输出:
相关问题 更多 >
编程相关推荐