我该如何根据单词的位置来拆分字符串?
我的数据长这样:
test = 'annamarypeterson, Guest Relations Manager, responded to this reviewResponded 1 week agoDear LoreLoreLore,Greetings from Amsterdam!We have received your wonderful comments and wanted to thank you for sharing your positive experience with us. We are so thankful that you have selected the Andaz Amsterdam for your special all-girls weekend getaway. Please come and see us again in the near future and let our team pamper you and your girlfriends!!Thanks again!Anna MaryAndaz Amsterdam -Guest RelationsReport response as inappropriateThank you. We appreciate your input.This response is the subjective opinion of the management representative'
我需要这个输出结果:
responder = 'annamarypeterson, Guest relations Manager'
date = 'Responded 1 week ago'
response = 'Dear ....' #without 'This response is the subjective opinion of the management representative'
我知道find.()
函数给出单词的位置,我想使用这个位置告诉Python在哪里切割它。例如:
splitat = test.find('ago')+3
我该使用哪个函数以整数为分隔符进行字符串分割?split()
函数不支持整型参数。