This is not about decoding using UTF-8. This is about reading a bytes object as a literal and needing it as a bytes object without reinventing the parsing process. If there is an answer to my question out there, it is hiding behind a lot of answers to questions about decoding.
Here is what I need:
x = "bytearray(b'abc\xd8\xa2\xd8\xa8\xd8\xa7xyz')"
y = ???(x, ???)
z = bytearray(b'abc\xd8\xa2\xd8\xa8\xd8\xa7xyz')
if y == z:
print ("Yes!")
Any suggestions for how to replace those question marks?
Thanks!
-- Dave
bytearrayliteral to produce something more friendly instead.