申し訳ありませんが、別のPython初心者の質問です。私は文字列を持っています:
my_string = "<p>this is some \n fun</p>And this is \n some more fun!"
をお願いします:
my_string = "<p>this is some fun</p>And this is \n some more fun!"
つまり、 htmlタグ内で発生した場合にのみ'\ n'を削除するにはどうすればよいですか?
私は持っています:
my_string = re.sub('<(.*?)>(.*?)\n(.*?)</(.*?)>', 'replace with what???', my_string)
これは明らかに機能しませんが、私は立ち往生しています。