【发布时间】:2019-04-29 04:27:11
【问题描述】:
我想用 python regex python 把“is”这个词后面的整个句子。
我的代码:
s = '''Robert is an English actor, model and musician.
He started his film career by playing Cedric Diggory in Harry Potter.'''
r = re.findall(r'(?:is) (.*)',s)
print(r)
我希望输出是:
'an English actor, model and musician'
但实际输出是:
['an English actor, model and musician','film career by playing Cedric Diggory in Harry Potter']
【问题讨论】:
标签: python regex python-3.x string