我有以下声明
sentence = " Hi my goal is to achieve highest score in mathematics, but my friend has scored some how more. and now i am myself depressed.
我想用“代词”替换所有的“my”,如下所示。我不想取代我自己,我想保持现状
预期输出为:
Hi PRONOUN goal is to achieve highest score in mathematics, but PRONOUN friend has scored some how more. and now i am myself depressed.
我试过用python跟踪regex
regex = re.sub(r'\\bmy$')
你很接近。在起点和终点使用边界。你知道吗
例如:
输出:
相关问题 更多 >
编程相关推荐