我一直在查看re文档、搜索网络和尝试许多方法几个小时,但仍然找不到一种方法来删除字符串的某个部分。
因此,这个字符串看起来是这样的:
Linda Lost (Secret Icecone Incorporated) lost their Kronos in Osmon (The Forge). Final Blow by Liberty Prime (Exit-Strategy) flying in a Arbitrator. Total Value: 1,865,802,910.96 ISK
基本上,当从网站的元数据中提取字符串时,所有名称和内容都会更改。唯一确定的是“Final Blow by”、“Total Value:”和“ISK”的内容是相同的。
因此,我一直在尝试弄清楚的是如何删除整个“Total Value:1,865,802,910.96 ISK”部分,并返回其前面的内容。
非常感谢任何帮助。谢谢!
someString[:someString.find('Total Value:')]
- pokes.split('Total Value:')[0]
- Iron Fistre.search(r'.*(?=Total Value:)', s).group()
- Iron Fist