Skip to content

Tag: html-entities

Writing HTML Entities to a File

I’m getting a UnicodeEncodeError when I run the code below. It simply loops until i = 9000, appends an html entity to a list based upon the value of i, then writes the list to a file after looping. Doe’s anyone know where I’m going wrong? Answer By default this open method doesn’t supp…

Python3 Convert all characters to HTML Entities

I’m using Python3 and I wonder if there is a module or a default function for converting all characters of a text to html entities (even the letters and digits) because I don’t want to make a translation map for this. Solved: As @justhalf told me, I found the solution by making this function: Answ…