Python – ‘ascii’ codec can’t decode byte
encode converts a unicode object to a string object. But here you have invoked it on a string object (because you don’t have the u). So python has to convert the string to a unicode object first. So it does the equivalent of But the decode fails because the string isn’t valid ascii. That’s why you get a complaint about not being able to … Read more