Is there a codec in python that will escape everything that is not in the ascii range of 48-57 or 65-122 (i.e. not a alpha-numeric)
The only exception would be a slash and backslash characters.
Ideally, I would want to convert something like this:
/MyString/My#^/Blah/
To this:
/MyString/My\x23\x5e/Blah/
I know that there is the string-escape encoding which does something similar, but I need a custom range of characters to be encoded. I’m looking for clever suggestions or modules that can do this efficiently.
Thanks!
You can use
re.subwith a function parameter like this: