BeautifulSoup4で全ての文字を書き換える
タグを辿って、tag.stringの書き換えを繰り返すと、NavigableStringは書き換え不可能!と怒られた。ごめん。
公式documentをよく読んだら、replace_with()
つかえとのこと。
teratailに質問もいいけど、公式ドキュメントも読もう。うん。
参考
BeautifulSoup公式
Beautiful Soup Documentation — Beautiful Soup 4.4.0 documentation
実装例
BeautifulSoup4 TreeNode traverse and fix Navigable ...