Filtering out certain bytes in python
问题 I'm getting this error in my python program: ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters This question, random text from /dev/random raising an error in lxml: All strings must be XML compatible: Unicode or ASCII, no NULL bytes, explains the issue. The solution was to filter out certain bytes, but I'm confused about how to go about doing this. Any help? Edit: sorry if i didn't give enough info about the problem. the string data comes