用python正则提取被告原告:中国人民人寿保险股份有限公司安阳中心支公司文本中的被告
可以使用以下代码:
import re
text = "被告(原告):中国人民人寿保险股份有限公司安阳中心支公司,"
pattern = r"被告(原告):(.+?),"
match = re.search(pattern, text)
if match:
defendant = match.group(1)
print(defendant)
else:
print("未找到被告")
输出结果为:
中国人民人寿保险股份有限公司安阳中心支公司
原文地址: http://www.cveoy.top/t/topic/g1pZ 著作权归作者所有。请勿转载和采集!