私は一生のように見えるこのコードを実行してきましたが、それを機能させることができないようです。
pattern = "\[([a-zA-Z0-9].*?)#([a-zA-Z0-9].*?)\]"
pattern_obj = re.compile(pattern, re.MULTILINE)
translation = pattern_obj.sub("<ol>\\1</ol>", translation)
ここでやろうとしているのは、いくつかのテキストを変更することです。
[
# This is item number one in an ordered list. #
# And this is item number two in the same list. #
]
の中へ:
<ol>
#This is item number one in an ordered list. #
#And this is item number two in the same list. #
</ol>
基本的に、[ と ] の間のテキストをテキストのどこかで # で識別し、すべての内部テキストを同じに保ちながら[ を<ol>
と ] に変更することになっています。</ol>
誰でもアドバイスできますか?
前もって感謝します!