>>> a = 55
>>> b = "hello"
>>> ~a # this will work
>>> ~b # this will fail
>>> ~"alpha bravo"
No, this is not possible in Python. You can not add new methods to built-in types in a way that will work reliably.
One thing you could do is subclass string, and define the magic method
__invert__. But it would not work on string literals, only on instances of your subclass.