Python:从字符串中提取子字符串

时间:2014-11-20 15:38:35

标签: python string text-extraction

我想从'test'中提取'<AAA>test</AAA>'。这是我的代码。我相信它可以改进:

test = '<AAA>test</AAA>'

test = test.replace('</AAA>', '<AAA>')
test = test.split('<AAA>')
test = test[1]

print(test)

关于如何以更轻松的方式编写它的任何想法?

非常感谢......

0 个答案:

没有答案
相关问题