**scriptum** module provides you many common & uncommon cases in python, including some text manipulation functions & conversions
- Functions for most popular cases.
- Text manipulation functions.
- Pure python 3.10 to 3.14+.
- No dependencies.
- custom text and background colouring.
- Binary conversion.
- Hexadecimal notation & decimal code point unicode conversion.
- Conversion between: cases, binary, unicode.
The available cases in scriptum are:
| case | view |
|---|---|
| mocking | MoCkInG CaSe |
| camel | camel Case |
| pascal | PascalCase |
| snake | snake_case |
| kebab | kebab-case |
| cobol | COBOL-CASE |
| constant | CONSTANT_CASE |
| train | Train-Case |
some cases have alias names:
| name | alias |
|---|---|
| constant | upper_snake |
| constant | const |
Pytext also features various manipulative functions, which includes:
| function | description |
|---|---|
| convert(text, type, to) | convert text to to |
| binary(text) | Represent text in binary |
| unicodify(text, hexa) | Return text in unicode |
| color(text, color, bgc, style) | Colors text |
pip install scriptum>>> from scriptum import reverse, pascal, convert
>>> reverse("Hello world", foreach=True)
'dlrow olleH'
>>> pascal("foo bar baz")
'Foo Bar Baz'
>>> convert("MAX_SPEED", type_="constant", to="train")
'Max-Speed'all the formats, cases, types in scriptum are collected in one function: convert:
>>> from scriptum import convert
>>> convert(
... "01001000 01100001 01100011 01101011 01100101 01110010",
... type_="binary",
... to="mocking"
... )
'HaCkEr'
>>> convert(
... text="0x0048 0x0069 0x0021 0x0021 0x0021",
... type_="unicode",
... to="string"
... )
'Hi!!!'Unicode is greatly supported, as you can use any function on any non-ASCII Characters:
>>> from scriptum import reverse
>>> reverse("أهلا", foreach=True) # non-ASCII Characters (Arabic)
'الهأ'
And the unicodify function in scriptum, can assist in converting to either Unicode Hexadecimal Code Points (0xXXXX), or Decimal Code Points (NNN)
-
The color function, may fail to do it's job in some console environments.
-
Although you can use any unicode character, sometimes it's seemingless to use them as some cases doesn't exist in other writing systems:
>>> from scriptum import camel
>>> camel("谢谢") # Chinese (non-ASCII)
'谢谢' # No change (seemless)- The binary function represents only string datatypes (
str), thus any other type given is internally converted to string.
>>> from scriptum import binary
>>> binary(5) # non-string
'00110101'
>>> binary("5")
'00110101'