Python module which help to cut html string by keeping html tags as it is
It is easy to extract an excerpt of a text string with a given length limit. But if you want to extract an excerpt from HTML, the tags that may exist in the text string make it more complicated.
This module provides a solution to extract excerpts from HTML documents with a given text length limit without counting the length of any HTML tags.
This package is used to cut the string which is having html tags. It does not count the html tags, it just count the string inside tags and keeps the tags as it is.
ex: If the string is “welcome to <b>Python World</b> <br/> Python is bla”. and If we want to cut the string of 16 charaters then output will be “welcome to <b>Python</b>”.
Here while cutting the string it keeps the tags for the cutting string and skip the rest and without distorbing the div structure.
obj = HtmlCutString(“welcome to <b>Python World</b> <br/> Python is”,16)
newCutString = obj.cut()
- newCutString = cutHtmlString(“welcome to <b>Python World</b> <br/> Python is”,16)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size htmlcutstring-1.1.tar.gz (1.7 kB)||File type Source||Python version None||Upload date||Hashes View|
|Filename, size htmlcutstring-1.1.zip (2.1 kB)||File type Source||Python version None||Upload date||Hashes View|