Is there a way to globally suppress the unicode string indicator in python? I’m working exclusively with unicode in an application, and do a lot of interactive stuff. Having the u’prefix’ show up in all of my debug output is unnecessary and obnoxious. Can it be turned off?
Share
You could use Python 3.0.. The default string type is unicode, so the
u''prefix is no longer required..In short, no. You cannot turn this off.
The
ucomes from theunicode.__repr__method, which is used to display stuff in REPL:If I’m not mistaken, you cannot override this without recompiling Python.
The simplest way around this is to simply print the string..
If you use the
unicode()builtin to construct all your strings, you could do something like....but don’t do that, it’s horrible