Skip to main content
A function to remove control characters / non-printing characters from strings and binaries
$pip install get-the-hell-out-of-here

from get_the_hell_out_of_here import remove_escaped_characters

import numpy as np

test1 = np.array(["hi, my friend", "are you fine?"]).tobytes() #lets create some test data



#numpy as bytes

b"h\x00\x00\x00i\x00\x00\x00,\x00\x00\x00 \x00\x00\x00m\x00\x00\x00y\x00\x00\x00 \x00\x00\x00f\x00\x00\x00r\x00\x00\x00i\x00\x00\x00e\x00\x00\x00n\x00\x00\x00d\x00\x00\x00a\x00\x00\x00r\x00\x00\x00e\x00\x00\x00 \x00\x00\x00y\x00\x00\x00o\x00\x00\x00u\x00\x00\x00 \x00\x00\x00f\x00\x00\x00i\x00\x00\x00n\x00\x00\x00e\x00\x00\x00?\x00\x00\x00"

print(remove_escaped_characters(test1))

#Result:  b'hi, my friendare you fine?'



test2 = b"h\\x00\\x00\\x00i\\x00\\x00\\x00,\\x00\\x00\\x00 \\x00\\x00\\x00m\\x00\\x00\\x00y\\x00\\x00\\x00 \\x00\\x00\\x00f\\x00\\x00\\x00r\\x00\\x00\\x00i\\x00\\x00\\x00e\\x00\\x00\\x00n\\x00\\x00\\x00d\\x00\\x00\\x00a\\x00\\x00\\x00r\\x00\\x00\\x00e\\x00\\x00\\x00 \\x00\\x00\\x00y\\x00\\x00\\x00o\\x00\\x00\\x00u\\x00\\x00\\x00 \\x00\\x00\\x00f\\x00\\x00\\x00i\\x00\\x00\\x00n\\x00\\x00\\x00e\\x00\\x00\\x00?\\x00\\x00\\x00" #double escaped

print(remove_escaped_characters(test2))

# Result:   b'hi, my friendare you fine?'





test3 = "h\x00\x00\x00i\x00\x00\x00,\x00\x00\x00 \x00\x00\x00m\x00\x00\x00y\x00\x00\x00 \x00\x00\x00f\x00\x00\x00r\x00\x00\x00i\x00\x00\x00e\x00\x00\x00n\x00\x00\x00d\x00\x00\x00a\x00\x00\x00r\x00\x00\x00e\x00\x00\x00 \x00\x00\x00y\x00\x00\x00o\x00\x00\x00u\x00\x00\x00 \x00\x00\x00f\x00\x00\x00i\x00\x00\x00n\x00\x00\x00e\x00\x00\x00?\x00\x00\x00" #as string

print(remove_escaped_characters(test3))

#Result: hi, my friendare you fine?



test4 = "h\\x00\\x00\\x00i\\x00\\x00\\x00,\\x00\\x00\\x00 \\x00\\x00\\x00m\\x00\\x00\\x00y\\x00\\x00\\x00 \\x00\\x00\\x00f\\x00\\x00\\x00r\\x00\\x00\\x00i\\x00\\x00\\x00e\\x00\\x00\\x00n\\x00\\x00\\x00d\\x00\\x00\\x00a\\x00\\x00\\x00r\\x00\\x00\\x00e\\x00\\x00\\x00 \\x00\\x00\\x00y\\x00\\x00\\x00o\\x00\\x00\\x00u\\x00\\x00\\x00 \\x00\\x00\\x00f\\x00\\x00\\x00i\\x00\\x00\\x00n\\x00\\x00\\x00e\\x00\\x00\\x00?\\x00\\x00\\x00"  #as string - double escaped

print(remove_escaped_characters(test4))

#Result: hi, my friendare you fine?

Metadata

Release files for get-the-hell-out-of-here 0.12

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

Source distribution (sdist)

Source distribution for get-the-hell-out-of-here 0.12
File Size Uploaded Provenance Actions
get_the_hell_out_of_here-0.12.tar.gz 5.2 kB Without provenance Details for get_the_hell_out_of_here-0.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for get-the-hell-out-of-here 0.12
File Interpreter ABI Platform Actions
get_the_hell_out_of_here-0.12-py3-none-any.whl Python 3 none any Details for get_the_hell_out_of_here-0.12-py3-none-any.whl

Total release size: 10.6 kB

Release files / get_the_hell_out_of_here-0.12.tar.gz

Download URL get_the_hell_out_of_here-0.12.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
326c386e0833a4c4c82d2e30fb45ad3c74857a7621f54d6b3d2e3fe2483b5439
BLAKE2b-256 checksum
How to use checksums
c7402acce2407a03fe5c091f4709f557dd9d1511b5bcd850ceb2aceb2867d6a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / get_the_hell_out_of_here-0.12-py3-none-any.whl

Download URL get_the_hell_out_of_here-0.12-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d21309c2d52cce7ae301b31341bc2341b65bf556e4ba4f42122f5122c9f0056e
BLAKE2b-256 checksum
How to use checksums
96c5fc64c8c7db0e9f6b01790da1c0b69a0b64b733c3b093d07408800bc45219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for get-the-hell-out-of-here 0.12

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.

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