我正在试图弄清楚如何做到这一点:
>>>sentence = "There's something right there."
>>>change_s(sentence)
['there', 'his', 'something', 'right', 'there.']
>>>sentence = "it's Patrick's car."
>>>change_s(sentence)
['it', 'his', 'Patrick', 'his', 'car.']
所以基本上我想把“'s”改为“他的”(即使它在语法上不正确)并将这些单词放在一个列表中。
答案 0 :(得分:1)
In [6]: sentence = "There's something right there."
In [7]: sentence.replace("'s", " his").split()
Out[7]: ['There', 'his', 'something', 'right', 'there.']