I am working on a personal project. It's basically a program for changing specific tags from certain HTML files.
So far, everything works. The GUI and the logic a work but I know the main function is wrong because it looks like this:
def tag_remove(HTML_string): clean_HTML = a_string.replace('<b>', '').replace('<i>', '').replace('<p>', '').replace('<h1>', '') #etc. return cleaned
Is there a way of doing this using a data structure like a list, tuple or dictionary? I don't want it to be so recursive. I was thinking of a dictionary where the key would be the tag to replace and the value the value for which it should be replaced. But I don't know how to do that.
Edited 4 Years Ago by G_S