planetp
planetp

Reputation: 16085

How do I check if two html-strings are equivalent with python?

I need to compare two strings, containing HTML text. The test should return true if the html strings are equivalent, i.e. differ only in whitespace and comments.
Is there any module that can be used for this task?

Upvotes: 4

Views: 264

Answers (1)

Hank Gay
Hank Gay

Reputation: 71969

There's this wrapper around HTMLTidy. HTMLTidy allows you to suppress comments and normalize formatting, etc., so that should do the trick.

Upvotes: 4

Related Questions