G
G
GitCat2020-07-03 12:05:01
Python
GitCat, 2020-07-03 12:05:01

How to make beautiful and convenient HTML from HTML code written in one line using Python?

Hello! I have a python html code generator but it generates it in one line. Is there any algorithm in python that turns HTML code written in one line into usable and readable HTML? I've tried through the BeautifulSoup library and the prettify() method, but the code doesn't get any more readable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2020-07-03
@GitCat

That helped. However, the prettify() method gives code that is not quite readable (instead of tabs, 1 space, etc.)

You can tweak Tag.prettify() and specify your own indentation
https://stackoverflow.com/a/15513404
Why they didn't put them in the settings is a mystery.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question