これを含むファイルがあります:
<html>
<head>
<title> Hello! - {{ today }}</title>
</head>
<body>
{{ runner_up }}
avasd
{{ blabla }}
sdvas
{{ oooo }}
</body>
</html>
{{today}}
、などを抽出するための最良または最も Pythonic な方法は何{{runner_up}}
ですか?
分割/正規表現でできることは知っていますが、別の方法があるのではないかと思いました。
PS: という変数にロードされたデータを考えてみましょうthedata
。
編集: HTML の例は悪いと思います。なぜなら、一部のコメント投稿者が BeautifulSoup に誘導されたからです。したがって、ここに新しい入力データがあります。
Fix grammatical or {{spelling}} errors.
Clarify meaning without changing it.
Correct minor {{mistakes}}.
Add related resources or links.
Always respect the original {{author}}.
出力:
spelling
mistakes
author