ZalgoLib

raw JSON →
0.2.2 verified Fri May 01 auth: no python

A Python library for generating Zalgo text (combining diacritical marks to create corrupted, horror-style text). Current version 0.2.2, updated Oct 2024. Release cadence is low, with no recent commits.

pip install zalgolib
error AttributeError: module 'zalgolib' has no attribute 'Zalgo'
cause Incorrect import: `import zalgolib` then `zalgolib.Zalgo` used to work in older versions but may break due to lazy loading.
fix
Use from zalgolib import Zalgo.
error TypeError: __init__() got an unexpected keyword argument 'intensity'
cause The `Zalgo` constructor does not accept `intensity`; it is only a parameter in `zalgofy()`.
fix
Remove intensity from constructor: Zalgo() then call zalgofy(text, intensity=...).
gotcha The `Zalgo` class uses a global pseudo-random number generator. If you need reproducible output, set `random.seed()` before creating the instance.
fix Call `random.seed(42)` before `z = Zalgo()`.
deprecated The `zalgofy()` method with positional arguments (e.g., `z.zalgofy(text, intensity)`) is the only supported signature. Do not rely on keyword-only arguments as they may change.
fix Use `z.zalgofy(text, intensity=0.5)` or just positional.

Create a Zalgo instance and apply default intensity to a string.

from zalgolib import Zalgo

z = Zalgo()
text = "Hello, World!"
zalgofied = z.zalgofy(text, intensity=1.0)
print(zalgofied)