Skip to main content

This is repository is an improved version of htmlcutstring (https://code.google.com/p/cut-html-string/). I’m not the original author.

Differences between original

  1. htmlcutstr has availability to count words instead of characters

  2. It works fine on both Python 2.x and 3.x

Installation

Run ‘setup.py install’ to install this package.

Usage

cutHtmlString(string, limit, countType=’c’)

string is obviously the string you want to cut
limit maximum number of characters/words (depending on countType value) output string can have
countType can be equal to ‘c’ or ‘w’
‘c’ means ‘count by characters’
‘w’ means ‘count by words’.

Examples

from htmlcutstr import cutHtmlString

htmlstring = '<div>insert your <a>text</a> here</div>'

print(cutHtmlString(htmlstring, 10)) # '<div>insert you</div>'
print(cutHtmlString(htmlstring, 3, 'w')) # '<div>insert your <a>text</a></div>'

Metadata

Release files for htmlcutstr 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for htmlcutstr 1.2.1
File Size Uploaded Provenance Actions
htmlcutstr-1.2.1.tar.gz 2.0 kB Without provenance Details for htmlcutstr-1.2.1.tar.gz

Release files / htmlcutstr-1.2.1.tar.gz

Download URL htmlcutstr-1.2.1.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a07ad4b5605ca2565669250016d04f88b8e1fa167eff8fe20544e9260a96dd35
BLAKE2b-256 checksum
How to use checksums
02a53a4386c5d4952010f59748d97d502e5264ffd03e641da58d994fe6eda96e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for htmlcutstr 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page