我有一个很长的文字,其中的部分用+++括起来,我想用方括号括起来
se1 = "+++TEXT:+++ Moshe Morgenstern is on his way to the main synagogue in the center of Bnei Brak,home to a largely ultra-orthodox - or haredi - community. +++ : Bnei Brak,Tel Aviv + Jerusalem ))+++"
我想将+++中包含的文本转换为[[]],
+++TEXT+++ should become [[TEXT]]
我的代码:
import re
se1 = "+++TEXT:+++ Moshe Morgenstern is on his way to the main synagogue in the center of Bnei Brak,home to a largely ultra-orthodox - or haredi - community. +++ Karte Israel mit: Bnei Brak,Tel Aviv + Jerusalem ))+++"
comments = re.sub(r"\+\+\+.*?\+\+\+",r"[[.*?]]",se1)
print(comments)
但是输出错误
[[.*?]] Moshe Morgenstern is on his way to the main synagogue in the center of Bnei Brak,home to a largely ultra-orthodox - or haredi - community. [[.*?]]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。