79534457

Date: 2025-03-25 17:44:39
Score: 1
Natty:
Report link

Turns out you can just stick a b in front of each string to convert it to bytes and everything works great!

class DownloadHandler(web.RequestHandler): 
    def get(self): 
        files_as_text = b"" 
        for file in os.listdir("files"): 
            files_as_text += file.encode("utf-8")+b"---title_split---"+open("files/"+file, "rb").read()+b"---file_split---" 
        self.write(files_as_text)
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Curtis C