输出重新计算的结果

2024-05-23 13:58:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下代码:

import re

targetFile = open("test.txt").read()

print(re.search('(<\\/nesting_tag>)',targetFile))

我的想法是,我在两个时间段之间返回所有内容。例如测试时的“测试”。如何返回“Test”而不是<_sre.sre_匹配对象;span=(56,70),匹配=“”>


Tags: 代码testimportretxt内容readsearch