On 2019-03-07 17:19, tony wrote: > Python 3.5.3 (default, Sep 27 2018, 17:25:39) > >>> "a\\nb".decode("string-escape") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'str' object has no attribute 'decode'
Looks like bytestring.decode('unicode_escape') does what you're describing: >>> b"hello\nworld".decode('unicode_escape') 'hello\nworld' >>> print(b"hello\nworld".decode('unicode_escape')) hello world -tkc -- https://mail.python.org/mailman/listinfo/python-list