Created
January 23, 2024 11:14
-
-
Save johngian/ef8b84c3f60903a4454ae39bac42c9c3 to your computer and use it in GitHub Desktop.
Beautify HTML using beautiful soup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import click | |
from bs4 import BeautifulSoup | |
@click.command() | |
@click.argument("path") | |
def main(path): | |
with open(path, "r") as f: | |
html = f.read() | |
pretty = BeautifulSoup(html).prettify() | |
click.echo(pretty) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment